[Bug debug/39355] [4.4 Regression] Revision 144529 miscompiled libcpp/expr.c

dave at hiauly1 dot hia dot nrc dot ca gcc-bugzilla@gcc.gnu.org
Fri Mar 20 13:18:00 GMT 2009



------- Comment #30 from dave at hiauly1 dot hia dot nrc dot ca  2009-03-20 13:17 -------
Subject: Re:  [4.4 Regression] Revision 144529 miscompiled libcpp/expr.c

> With todays, head, it seems the miscompilation is related to the inlining
> of check_promotion.  Adding noinline attribute makes the ICE go away.
> Adding __attribute__((__optimize__(0))) or __attribute__((__optimize__(1)))
> also makes the ICE go away.  Removing either half of the
> "if (op->value.unsignedp)" also makes the ICE go away.  However, I haven't
> been able to spot the actual miscompilation yet.

Just want to add that the bug is not in the code inlined by the call
to check_promotion.  It's not entered in the testcase.  The inlining
changes the register allocation and some of the optimizations applied
to _cpp_parse_expr.

A small change can make the ICE disappear.  For example, the ICE
doesn't appear with:

Index: expr.c
===================================================================
--- expr.c      (revision 144962)
+++ expr.c      (working copy)
@@ -1023,8 +1023,10 @@
   prio = optab[op].prio - ((optab[op].flags & LEFT_ASSOC) != 0);
   while (prio < optab[top->op].prio)
     {
+#if 1
       if (CPP_OPTION (pfile, warn_num_sign_change)
          && optab[top->op].flags & CHECK_PROMOTION)
+#endif
        check_promotion (pfile, top);

       switch (top->op)

Dave


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39355



More information about the Gcc-bugs mailing list