This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
optimization/4875: Optimiser produces incorrect code for i386 platforms
- From: ahelm at gmx dot net
- To: gcc-gnats at gcc dot gnu dot org
- Date: 14 Nov 2001 12:20:32 -0000
- Subject: optimization/4875: Optimiser produces incorrect code for i386 platforms
- Reply-to: ahelm at gmx dot net
[Get raw message]
>Number: 4875
>Category: optimization
>Synopsis: Optimiser produces incorrect code for i386 platforms
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Wed Nov 14 04:26:01 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Anton Helm
>Release: gcc v3.0.2
>Organization:
>Environment:
gcc v3.0.2
Exactly the same behaviour using DJGPP
and Linux version.
>Description:
When running the attached program compiled with
any optimisation level greater than 0 the results
are incorrect. Hexadecimal output of the variable s
suggests that an incorrect sign extension is performed.
I.e. the 32 high bits of s are set to 1 when assigning a
positive long or long long literal to a long long variable.
The behaviour has been verified with gcc 3.0.2 on
PC/WinNT with DJGPP and on Linux.
Both show the incorrect results.
I don't have any detailed information on the two
Linux systems used to verify the problem because I didn't
run the tests there myself. I only know that one was a
SUSE and the other a Redhat distribution.
gcc v3.0.2 on Solaris v2.6 doesn't show this error.
>How-To-Repeat:
gcc -Wall o.c
gcc -Wall -O2 o.c
Run both executables and compare output.
>Fix:
Do not use any optimisation :-(
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/x-unknown-content-type-PFE32; name="O.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="O.c"
I2luY2x1ZGUgPHN0ZGlvLmg+DQoNCmNvbnN0IGludCBhWzEwXSA9IHstMSwgMSwgMCwgMSwgLTEs
IC0xLCAxLCAwLCAtMSwgLTF9Ow0KDQppbnQgbWFpbih2b2lkKQ0Kew0KICBsb25nIGxvbmcgczsN
CiAgaW50IGk7DQoNCiAgZm9yKGk9MDtpPDEwO2krKykNCiAgew0KICAgIHMgPSBhW2ldOw0KICAg
IGlmKHM8MCkNCiAgICB7DQogICAgICBzID0gLTIxNDc0ODM2NDhMTDsNCiAgICB9DQogICAgZWxz
ZQ0KICAgIHsNCiAgICAgIHMgPSAyMTQ3NDgzNjQ3TEw7DQogICAgfQ0KICAgIGZwcmludGYoc3Rk
ZXJyLCAiJWxsZCAlMDE2bGx4XG4iLCBzLCBzKTsNCiAgfQ0KDQogIHJldHVybiAwOw0KfQ0K