public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/13711] New: double assignment results in incorrect assembly
@ 2004-01-16 21:04 satter at synplicity dot com
2004-01-16 21:06 ` [Bug c/13711] " satter at synplicity dot com
2004-01-16 23:38 ` pinskia at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: satter at synplicity dot com @ 2004-01-16 21:04 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/13711] double assignment results in incorrect assembly
2004-01-16 21:04 [Bug c/13711] New: double assignment results in incorrect assembly satter at synplicity dot com
@ 2004-01-16 21:06 ` satter at synplicity dot com
2004-01-16 23:38 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: satter at synplicity dot com @ 2004-01-16 21:06 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From satter at synplicity dot com 2004-01-16 21:06 -------
Created an attachment (id=5504)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=5504&action=view)
shows a problem that occurs on gcc3.2 and gcc3.3
To test:
gcc -g -o gcc32bug gcc32bug.c
./gcc32bug
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13711
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/13711] double assignment results in incorrect assembly
2004-01-16 21:04 [Bug c/13711] New: double assignment results in incorrect assembly satter at synplicity dot com
2004-01-16 21:06 ` [Bug c/13711] " satter at synplicity dot com
@ 2004-01-16 23:38 ` pinskia at gcc dot gnu dot org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-01-16 23:38 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-01-16 23:38 -------
Invalid as you cannot depend on the order of calculation.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13711
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2004-01-16 23:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-16 21:04 [Bug c/13711] New: double assignment results in incorrect assembly satter at synplicity dot com
2004-01-16 21:06 ` [Bug c/13711] " satter at synplicity dot com
2004-01-16 23:38 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).