public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/40795] New: gcc generates incorrect code for inline assembly
@ 2009-07-18 7:54 bart dot vanassche at gmail dot com
2009-07-18 7:55 ` [Bug c/40795] " bart dot vanassche at gmail dot com
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: bart dot vanassche at gmail dot com @ 2009-07-18 7:54 UTC (permalink / raw)
To: gcc-bugs
The attached program generates the expected output when compiled and run with
any of the gcc 3.x, gcc 4.0/4.1/4.2/4.3 compilers, but not with gcc 4.4. The
details are as follows:
* gcc version and configuration (built from unmodified GNU sources):
~/gcc-4.4.0/bin/gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: /home/bart/software/gcc-4.4.0/configure --disable-linux-futex
--disable-mudflap --disable-nls --enable-languages=c,c++ --enable-threads=posix
--enable-tls --prefix=/home/bart/gcc-4.4.0
Thread model: posix
gcc version 4.4.0 (GCC)
* How to compile:
/home/bart/gcc-4.4.0/bin/gcc -g -m32 -mmmx -msse -fno-stack-protector -o
pushpopseg pushpopseg.i
* How to run:
./pushpopseg
* Expected output:
sp change after push = -2
sp change after pop = 2
fs after push and pop = 0003
sp change after push = -4
sp change after pop = 4
fs after push and pop = 0003
* Output with gcc 4.4.0 (not correct):
sp change after push = 141379319
sp change after pop = -141379319
fs after push and pop = 0003
sp change after push = 141379319
sp change after pop = -141379319
fs after push and pop = 0003
--
Summary: gcc generates incorrect code for inline assembly
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bart dot vanassche at gmail dot com
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40795
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/40795] gcc generates incorrect code for inline assembly
2009-07-18 7:54 [Bug c/40795] New: gcc generates incorrect code for inline assembly bart dot vanassche at gmail dot com
@ 2009-07-18 7:55 ` bart dot vanassche at gmail dot com
2009-07-18 9:15 ` rguenth at gcc dot gnu dot org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: bart dot vanassche at gmail dot com @ 2009-07-18 7:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from bart dot vanassche at gmail dot com 2009-07-18 07:55 -------
Created an attachment (id=18216)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18216&action=view)
Test case source code
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40795
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/40795] gcc generates incorrect code for inline assembly
2009-07-18 7:54 [Bug c/40795] New: gcc generates incorrect code for inline assembly bart dot vanassche at gmail dot com
2009-07-18 7:55 ` [Bug c/40795] " bart dot vanassche at gmail dot com
@ 2009-07-18 9:15 ` rguenth at gcc dot gnu dot org
2009-07-18 9:28 ` bart dot vanassche at gmail dot com
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-07-18 9:15 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from rguenth at gcc dot gnu dot org 2009-07-18 09:15 -------
asm("movw %4, %%fs\n"
"movl %%esp, %0\n"
"pushw %%fs\n"
"movl %%esp, %1\n"
"popw %%fs\n"
"movl %%esp, %2\n"
"movw %%fs, %3\n"
: "=m" (sp1), "=m" (sp2), "=m" (sp3), "=m" (fs2)
: "m" (fs1)
: "ax"
);
As you access sp2 in memory after modifying the stack pointer you get
a wrong stack slot location because sp2 lives at 12(%esp) from the
compilers view.
Either don't mess with the stack or use register input/output constraints.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40795
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/40795] gcc generates incorrect code for inline assembly
2009-07-18 7:54 [Bug c/40795] New: gcc generates incorrect code for inline assembly bart dot vanassche at gmail dot com
2009-07-18 7:55 ` [Bug c/40795] " bart dot vanassche at gmail dot com
2009-07-18 9:15 ` rguenth at gcc dot gnu dot org
@ 2009-07-18 9:28 ` bart dot vanassche at gmail dot com
2009-07-18 9:29 ` bart dot vanassche at gmail dot com
2009-07-18 10:07 ` rguenth at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: bart dot vanassche at gmail dot com @ 2009-07-18 9:28 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from bart dot vanassche at gmail dot com 2009-07-18 09:28 -------
Created an attachment (id=18217)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18217&action=view)
Test case source code
Added "esp" to constraint list.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40795
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/40795] gcc generates incorrect code for inline assembly
2009-07-18 7:54 [Bug c/40795] New: gcc generates incorrect code for inline assembly bart dot vanassche at gmail dot com
` (2 preceding siblings ...)
2009-07-18 9:28 ` bart dot vanassche at gmail dot com
@ 2009-07-18 9:29 ` bart dot vanassche at gmail dot com
2009-07-18 10:07 ` rguenth at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: bart dot vanassche at gmail dot com @ 2009-07-18 9:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from bart dot vanassche at gmail dot com 2009-07-18 09:29 -------
Same result with "esp" added to constraint list.
--
bart dot vanassche at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40795
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c/40795] gcc generates incorrect code for inline assembly
2009-07-18 7:54 [Bug c/40795] New: gcc generates incorrect code for inline assembly bart dot vanassche at gmail dot com
` (3 preceding siblings ...)
2009-07-18 9:29 ` bart dot vanassche at gmail dot com
@ 2009-07-18 10:07 ` rguenth at gcc dot gnu dot org
4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-07-18 10:07 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from rguenth at gcc dot gnu dot org 2009-07-18 10:07 -------
Use register input/output constraints. You can't take away esp from the
compiler.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40795
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-07-18 10:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-18 7:54 [Bug c/40795] New: gcc generates incorrect code for inline assembly bart dot vanassche at gmail dot com
2009-07-18 7:55 ` [Bug c/40795] " bart dot vanassche at gmail dot com
2009-07-18 9:15 ` rguenth at gcc dot gnu dot org
2009-07-18 9:28 ` bart dot vanassche at gmail dot com
2009-07-18 9:29 ` bart dot vanassche at gmail dot com
2009-07-18 10:07 ` rguenth 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).