Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 190154 - gcc 4.2.0 miscompiles bitfields
Summary: gcc 4.2.0 miscompiles bitfields
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Gentoo Toolchain Maintainers
URL: http://lists.mplayerhq.hu/pipermail/m...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-25 08:27 UTC by Reimar Döffinger
Modified: 2007-10-07 02:14 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
testcase that miscompiles for me (bitbug.c,262 bytes, text/plain)
2007-08-25 08:27 UTC, Reimar Döffinger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Reimar Döffinger 2007-08-25 08:27:03 UTC
Copied from URL:
For anything bigger than -O1 it gives this output:
> reimar at hokum ~ $ gcc -O2 bitbug.c -o bitbug
> reimar at hokum ~ $ ./bitbug 0 1
> vals: 0 0 1 0

output should be
> vals: 0 -1 1 0

If you can confirm that this is not only due to some breakage on my system, I think gcc 4.2.0 should be -amd64, since this is a quite trivial feature and it is completely broken.
I will attach the sample C file shortly.
Comment 1 Reimar Döffinger 2007-08-25 08:27:58 UTC
Created attachment 129116 [details]
testcase that miscompiles for me
Comment 2 Peter Alfredsen (RETIRED) gentoo-dev 2007-08-25 09:15:06 UTC
pa@loki ~ $ for optlevel in 0 1 2 s 3; do gcc -O${optlevel} bitbug.c -o bitbug&&./bitbug 0 1&&rm ./bitbug; done
vals: 0 -1 1 0
vals: 0 1 1 0
vals: 0 0 1 0
vals: 0 0 1 0
vals: 0 0 1 0

This is on i686-pc-linux-gnu gcc 4.2.0
Comment 3 SpanKY gentoo-dev 2007-08-25 09:16:11 UTC
this is already known and fixed in gcc-4.2.1
Comment 4 SpanKY gentoo-dev 2007-10-07 02:14:51 UTC
gcc-4.2.1 in the tree