Bug 55227 - gcc miscompiles test app, embedded asm
Summary: gcc miscompiles test app, embedded asm
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc   
(Show other bugs)
Version: 7.2
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
Depends On:
TreeView+ depends on / blocked
Reported: 2001-10-27 19:04 UTC by Manfred Spraul
Modified: 2007-04-18 16:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-10-02 00:45:18 UTC
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 19:06 UTC, Manfred Spraul
no flags Details

Description Manfred Spraul 2001-10-27 19:04:33 UTC
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 19:06:58 UTC
Created attachment 35262 [details]
test app

Comment 2 Jakub Jelinek 2001-10-29 10:21:17 UTC
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-02 00:45:18 UTC
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.