Created attachment 24595 [details] testcase Compilation of attached file generates wrong warning: $ g++-4.4.5 -c -O2 -Wall all.c all.c: In function ‘void test(const st_src_reg*, ureg_dst)’: all.c:118: warning: ‘reg’ is used uninitialized in this function all.c:118: note: ‘reg’ was declared here And produces wrong code - at random after "test" function, src[i].Negate (one bit unsigned bit-field) becomes 1 when src_reg[i]->negate == 0 - something which should not happen. The bug does not manifest when compiled with gcc instead of g++ or with g++ 4.3.5 or 4.5.2.
Created attachment 24596 [details] g++ -v -save-temps -O2 -Wall -c all.c
Created attachment 24597 [details] standalone app testing this bug I'm attaching sources of standalone app which tests this bug. It should print: 0 0 0 0 Sometimes it prints: 1 1 1 1 a.out: main.c:14: void check_output(ureg_src*): Assertion `sum == 0' failed.
Created attachment 24598 [details] all.ii
Created attachment 24599 [details] all.s
I can't reproduce the runtime failure with gcc-4.6-20110621 on x86_64-linux. I see you're using Gentoo's modified gcc-4.4.5. Can you please try again with a g++ built from vanilla unmodified gcc-4.4.5 (or later 4.4.x) sources?
(In reply to comment #5) > I can't reproduce the runtime failure with gcc-4.6-20110621 on x86_64-linux. Of course I meant to write gcc-4.4-20110621 not 4.6...
I have this problem using the gcc 4.4.5 build in Ubuntu 10.10, which reports itself as "gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5". So it's not Gentoo-specific.
(In reply to comment #7) > I have this problem using the gcc 4.4.5 build in Ubuntu 10.10, which reports > itself as "gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5". So it's not > Gentoo-specific. That's also a heavily modified vendor compiler. Please try with an unmodified 4.4.5 or 4.4.6.
Gentoo does not patch gcc severely. See: http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-devel/gcc/gcc-4.4.5.ebuild?revision=1.10&view=markup which adds only 2 patches: http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-devel/gcc/files/gcc-spec-env.patch?revision=1.6&view=markup http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/sys-devel/gcc/files/4.4.0/gcc-4.4.0-softfloat.patch?revision=1.1&view=markup (arm specific) If that does not convince you, I can compile gcc without these patches. Just say so. Please note that runtime failure occurs in ~30-40% runs.
I don't think that .ebuild file describes everything in detail, specifically I strongly suspect they also apply 27 patches from gcc-4.4.5-patches-1.2.tar.bz2. I just recompiled the test case with a freshly built gcc-4.4.5 on x86_64-linux, and ran it 100 times. It failed zero times.
Ok, you are right. I didn't know about these patches. Now I compiled gcc-4.4.5 with "vanilla" USE flag - which disables all these patches - and it still fails at runtime.
Can't reproduce with current 4_4-branch, 4_5-branch, 4_6-branch, and mainline.