[Bug middle-end/39421] New: Wrong code for optimizition on 64-bit scalar integers
ktietz at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Mar 10 09:44:00 GMT 2009
All of these problems are adisappearing when the code is compiled without the
-O2 flag.
I have tried to reproduce the problems using simple code fragments, but I have
only succeeded in doing this for 2 of these problems (t1 and t3 in the attached
testcase). I cannot reproduce the other problem (t2 in the following code).
Running the program (with -O2) produced the following:
$ ~/a.exe
w is 8000000000000000
, V is 8000000000000000
t1 Wrong!
v != w
t2 Correct!
t3: w = 8000000000000000
t3 Wrong!
In our actual code corresponding to t2, we do the same comparison of
if ((uword) w > (uword) MX_S_W))
and the comparison fails when w was originally negative.
For t1 and t3, I can see why some optimisation might reason away the actual
tests, if it does not consider overflow of the signed word. Curiously, removing
the printf before if (w <= 0) ... line in t3 cause the
if (w <= 0) test to fail -- I don't see why this happens.
(in our original code, we don't have the printf, but w <= 0 does succeed, it is
the w == MN_S_W test that fails as in t3).
--
Summary: Wrong code for optimizition on 64-bit scalar integers
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: ktietz at gcc dot gnu dot org
GCC target triplet: x86_64-*-*
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39421
More information about the Gcc-bugs
mailing list