[Bug tree-optimization/43089] Optimizer ignores type in a conversion

0xe2 dot 0x9a dot 0x9b at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Feb 16 11:23:00 GMT 2010



------- Comment #3 from 0xe2 dot 0x9a dot 0x9b at gmail dot com  2010-02-16 11:23 -------
(In reply to comment #2)
> 
> If I were to modify the test case like this:
> 
> int i = ab.b;
> b2 = i + i;
> 
> I would be ALSO triggering undefined behavior. But the modified test-case would
> succeed at any optimization level.

Whoops. This obviously is one of my bad days: the modified test-case would fail
at -O2 as well. Anyway, the test-case was extracted from a much larger piece of
code which works OK if I compile it with -O2 but generates a segmentation fault
when compiled with -O3, because the optimization is deeper and allows the
compiler to evaluate the conditional expression at compile-time.

Let me return to the original issue: the inconsistency between the behavior at
-Oi vs -O(i+1). Are you going to fix it, or not?

> I don't think you understand what I am demanding here: I demand the compiler to
> have CONSISTENT BEHAVIOR in cases which are not defined by the standard. The
> modified code does clearly the SAME thing as the code in the test-case, only
> the intermediate conversion to the integer is now more explicit.


-- 


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



More information about the Gcc-bugs mailing list