public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/9242: GCC sometimes removes important asm statements
@ 2003-01-09 13:24 ebotcazou
0 siblings, 0 replies; 2+ messages in thread
From: ebotcazou @ 2003-01-09 13:24 UTC (permalink / raw)
To: adam, gcc-bugs, gcc-prs, nobody
Synopsis: GCC sometimes removes important asm statements
State-Changed-From-To: open->closed
State-Changed-By: ebotcazou
State-Changed-When: Thu Jan 9 05:24:10 2003
State-Changed-Why:
Duplicate of PR inline-asm/8832, for which I checked in the fix 5 minutes ago. How timely... :-)
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9242
^ permalink raw reply [flat|nested] 2+ messages in thread
* c/9242: GCC sometimes removes important asm statements
@ 2003-01-09 13:06 adam
0 siblings, 0 replies; 2+ messages in thread
From: adam @ 2003-01-09 13:06 UTC (permalink / raw)
To: gcc-gnats
>Number: 9242
>Category: c
>Synopsis: GCC sometimes removes important asm statements
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Thu Jan 09 05:06:01 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: Adam Lackorzynski
>Release: gcc version 3.2.2 20030108 (prerelease)
>Organization:
>Environment:
Debian woody/stable 3.0r1, x86, Linux 2.4.20
>Description:
Compiling the provided code the asm statements may not appear in the binary.
When compiling with -O2 or -O3 the resulting binary doesn't conain a "sti" statement.
When removing the "int a = 2 + a;" line from nothing() and compiling with -O2, there's as well no "sti" statement.
But compiling with -O3 it's there! And the code looks reasonable.
In the wrong cases there's a "hlt" in the code but on a rather suspicious place (i.e. not where one would expect it).
>How-To-Repeat:
void nothing(void) {
int a = 2 + a;
}
int main(void) {
int r = 1;
while (r) {
asm volatile ("sti");
asm volatile ("hlt");
while (r)
nothing();
}
return 0;
}
Compiled with
$ gcc -O2 -Wall -o z z.c
or $ gcc -O3 -Wall -o z z.c
and then:
objdump -d z
to see the resulting code
>Fix:
Add "cc" or "memory" to the clobber list of one asm statement.
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-01-09 13:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-09 13:24 c/9242: GCC sometimes removes important asm statements ebotcazou
-- strict thread matches above, loose matches on Subject: below --
2003-01-09 13:06 adam
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).