[Bug c/13711] New: double assignment results in incorrect assembly
satter at synplicity dot com
gcc-bugzilla@gcc.gnu.org
Fri Jan 16 21:04:00 GMT 2004
Tested and failed on i686-linux-gcc3.3 (32bit) and on opteron-linux-gcc3.2 (64bit)
I will attach the failing testcase to this bug. Essentially, what is going on
is this:
In this line of code:
globalArray[i] = value = do_something(i);
globalArray is a pointer to a dynamically allocated chunk of memory. Inside
the do_something function globalArray is reallocated to be larger. Normally, if
the code is written like this:
globalArray[i] = do_something(i);
or even this:
value = globalArray[i] = do_something(i);
then GCC understands that it cannot calculate the address for
globalArray[i] until after the do_something function returns. However,
in the bad case above, the assembly code that is generated calculates
the globalArray[i] address then calls do_something and then stores
the return value in the wrong (old) location.
I have also tried this test case using gcc 2.96 on the same i686-linux
machine and it works correctly, the problem only exists for gcc 3.2 and
3.3 (I don't have 3.4 to test).
tom
--
Summary: double assignment results in incorrect assembly
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: satter at synplicity dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13711
More information about the Gcc-bugs
mailing list