[Bug middle-end/58143] wrong code at -O3 on x86_64-linux-gnu

bernd.edlinger at hotmail dot de gcc-bugzilla@gcc.gnu.org
Tue Aug 20 00:21:00 GMT 2013


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

Bernd Edlinger <bernd.edlinger at hotmail dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bernd.edlinger at hotmail dot de

--- Comment #4 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
Created attachment 30674
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30674&action=edit
slightly simplified test case

attached is a slightly simplified test case.
The problem seems to start in the optimizer pass 097t.lim1
where the following expression is identified as loop-invariant of loop 3.

Moving statement
_23 = -2147483648 - c.1_22;
(cost 1) out of loop 3.

unfortunatley it is executed unconditionally now.

later the optimizer pass 110t.ivcanon uses the possible overflow
in this statement as an argument, why the loop must be executed exactly once.

Induction variable (int) 2147483647 + 1 * iteration does not wrap in statement
_23 = -2147483648 - prephitmp_8;
 in loop 2.
Statement _23 = -2147483648 - prephitmp_8;
 is executed at most 0 (bounded by 0) + 1 times in loop 2.

and shortly after that an apparently pointless loop-exit is removed.

Removed pointless exit: if (prephitmp_8 != 0)

however that is based on a worng assumption, and causes worng code.



More information about the Gcc-bugs mailing list