Bug 55227 - gcc miscompiles test app, embedded asm
gcc miscompiles test app, embedded asm
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2001-10-27 15:04 EDT by Manfred Spraul
Modified: 2007-04-18 12:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-10-01 20:45:18 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
test app (1.21 KB, text/plain)
2001-10-27 15:06 EDT, Manfred Spraul
no flags Details

  None (edit)
Description Manfred Spraul 2001-10-27 15:04:33 EDT
Description of Problem:
gcc miscompiles code with -O2, correct with -O0

Version-Release number of selected component (if applicable):

How Reproducible:
compile the attachment
	gcc -O2 -fomit-frame-pointer -o bad badgcc.cpp
	gcc -O0 -fomit-frame-pointer -o good badgcc.cpp
run it.

Actual Results:
got tsd 2152509265989 at esp=bffffb20h for time=bffffb50h.
got tsd 2152539497047 at esp=bffffb20h for time=bffffb48h.
needed 30231058 cycles (3.023106/call).
got tsd 2154240734828 at esp=bffffb20h for time=bffffb40h.
got tsd 2154270773195 at esp=bffffb20h for time=bffffb48h.

must be b50, not b40.

Expected Results:
got tsd 2143396909839 at esp=bffffb00h for time=bffffb60h.
got tsd 2143484049795 at esp=bffffb00h for time=bffffb58h.
needed 87139956 cycles (8.713996/call).
got tsd 2145186785406 at esp=bffffb00h for time=bffffb60h.
got tsd 2145273718039 at esp=bffffb00h for time=bffffb58h.
needed 86932633 cycles (8.693263/call).

Additional Information:
Comment 1 Manfred Spraul 2001-10-27 15:06:58 EDT
Created attachment 35262 [details]
test app
Comment 2 Jakub Jelinek 2001-10-29 05:21:17 EST
gcc 3.0 and gcc 3.1 behave similarly. gcc handles *FRAME_POINTER registers
specially apparently, even with -fomit-frame-pointer, when needed.
Comment 3 Richard Henderson 2004-10-01 20:45:18 EDT
This is dodgy code at best, but gcc 3.4 will at least give 

z.c:58: error: bp cannot be used in asm here

instead of generating code that crashes.

Note You need to log in before you can comment on or make changes to this bug.