<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
On 3/15/10 10:59 AM, Patrick Georgi wrote:
<blockquote cite="mid:4B9E04FF.9050308@georgi-clan.de" type="cite">
  <div class="moz-text-plain" wrap="true" graphical-quote="true"
 style="font-family: -moz-fixed; font-size: 13px;" lang="x-western">
  <pre wrap="">Am 15.03.2010 03:32, schrieb Keith Hui:
  </pre>
  <blockquote type="cite" style="color: rgb(0, 0, 0);">
    <pre wrap=""><span class="moz-txt-citetags">> </span>Hi all,
<span class="moz-txt-citetags">> </span>
<span class="moz-txt-citetags">> </span>I regret to report that the romcc patch circulated earlier to fix the
<span class="moz-txt-citetags">> </span>segfault I reported, is now causing another segfault. This also seems to
<span class="moz-txt-citetags">> </span>be triggered by something in the 440BX code, as it didn't segfault when
<span class="moz-txt-citetags">> </span>I compile for any mainboards that isn't 440BX. As of now I don't know
<span class="moz-txt-citetags">> </span>what this new segfault is. I'll report back with more findings.
    </pre>
  </blockquote>
  <pre wrap="">It seems the problem was that copy_triple() isn't supposed to be used on
flattened (and simple) nodes.
I built a simple test case that failed:
void main(void) {
        int c = 0;
        c |= 4;
}

With the attached patch, this testcase, your testcase, and a full abuild
run work.

Signed-off-by: Patrick Georgi <a moz-do-not-send="true"
 class="moz-txt-link-rfc2396E"
 href="mailto:patrick.georgi@coresystems.de"><patrick.georgi@coresystems.de></a>
  </pre>
  </div>
</blockquote>
I can't really verify if this is the correct thing to do, but since it
fixes abuild...<br>
<br>
Acked-by: Stefan Reinauer <a class="moz-txt-link-rfc2396E" href="mailto:stepan@coresystems.de"><stepan@coresystems.de></a><br>
<br>
<br>
<blockquote cite="mid:4B9E04FF.9050308@georgi-clan.de" type="cite">
  <div class="moz-text-plain" wrap="true" graphical-quote="true"
 style="font-family: -moz-fixed; font-size: 13px;" lang="x-western">
  <pre wrap="">
<fieldset class="mimeAttachmentHeader"><legend
 class="mimeAttachmentName">20100315-2-romcc</legend></fieldset>
Index: util/romcc/romcc.c
===================================================================
--- util/romcc/romcc.c  (Revision 5210)
+++ util/romcc/romcc.c  (Arbeitskopie)
@@ -11557,7 +11557,7 @@
 
 static struct triple *assignment_expr(struct compile_state *state)
 {
-       struct triple *def, *left, *right;
+       struct triple *def, *left, *left2, *right;
        int tok, op, sign;
        /* The C grammer in K&R shows assignment expressions
         * only taking unary expressions as input on their
@@ -11578,6 +11578,9 @@
         */
        def = conditional_expr(state);
        left = def;
+       left2 = left;
+       if (!(left2->id & TRIPLE_FLAG_FLATTENED))
+               left2 = copy_triple(state, left2);
        switch((tok = peek(state))) {
        case TOK_EQ:
                lvalue(state, left);
@@ -11603,19 +11606,19 @@
                }
                def = write_expr(state, left,
                        triple(state, op, left->type, 
-                               read_expr(state, copy_triple(state, left)), right));
+                               read_expr(state, left2), right));
                break;
        case TOK_PLUSEQ:
                lvalue(state, left);
                eat(state, TOK_PLUSEQ);
                def = write_expr(state, left,
-                       mk_add_expr(state, copy_triple(state, left), assignment_expr(state)));
+                       mk_add_expr(state, left2, assignment_expr(state)));
                break;
        case TOK_MINUSEQ:
                lvalue(state, left);
                eat(state, TOK_MINUSEQ);
                def = write_expr(state, left,
-                       mk_sub_expr(state, copy_triple(state, left), assignment_expr(state)));
+                       mk_sub_expr(state, left2, assignment_expr(state)));
                break;
        case TOK_SLEQ:
        case TOK_SREQ:
@@ -11639,7 +11642,7 @@
                }
                def = write_expr(state, left,
                        triple(state, op, left->type, 
-                               read_expr(state, copy_triple(state,left)), right));
+                               read_expr(state, left2), right));
                break;
        }
        return def;
  </pre>
  </div>
  <div class="moz-text-plain" wrap="true" graphical-quote="true"
 style="font-family: -moz-fixed; font-size: 13px;" lang="x-western">
  <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
<div class="moz-txt-sig">-- 
coreboot mailing list: <a moz-do-not-send="true"
 class="moz-txt-link-abbreviated" href="mailto:coreboot@coreboot.org">coreboot@coreboot.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext"
 href="http://www.coreboot.org/mailman/listinfo/coreboot">http://www.coreboot.org/mailman/listinfo/coreboot</a></div></pre>
  </div>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">-- 
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
      Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: <a class="moz-txt-link-abbreviated" href="mailto:info@coresystems.de">info@coresystems.de</a>  • <a class="moz-txt-link-freetext" href="http://www.coresystems.de/">http://www.coresystems.de/</a>
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866
</pre>
</body>
</html>