https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61190
Bug ID: 61190 Summary: [4.8/4.9/4.10 Regression] g++.old-deja/g++.mike/p4736b.C FAILs at -O2/-Os/-O3 Product: gcc Version: 4.10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: zsojka at seznam dot cz Created attachment 32798 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=32798&action=edit prep Valgrind output with various GCC versions: $ g++-trunk-r210412 -O2 p4736b.ii $ valgrind -q --track-origins=yes ./a.out ==11986== Use of uninitialised value of size 8 ==11986== at 0x4006F3: virtual thunk to Main::foo() (in /home/smatz/gcc-bug/1256/a.out) ==11986== by 0x400517: main (in /home/smatz/gcc-bug/1256/a.out) ==11986== Uninitialised value was created by a stack allocation ==11986== at 0x400500: main (in /home/smatz/gcc-bug/1256/a.out) ==11986== ==11986== Invalid read of size 8 ==11986== at 0x4006F3: virtual thunk to Main::foo() (in /home/smatz/gcc-bug/1256/a.out) ==11986== by 0x400517: main (in /home/smatz/gcc-bug/1256/a.out) ==11986== Address 0xffffffffffffffe8 is not stack'd, malloc'd or (recently) free'd ==11986== ==11986== ==11986== Process terminating with default action of signal 11 (SIGSEGV) ==11986== Access not within mapped region at address 0xFFFFFFFFFFFFFFE8 ==11986== at 0x4006F3: virtual thunk to Main::foo() (in /home/smatz/gcc-bug/1256/a.out) ==11986== by 0x400517: main (in /home/smatz/gcc-bug/1256/a.out) $ g++-4_9-r210307 -O2 p4736b.ii $ valgrind -q --track-origins=yes ./a.out ==12013== Use of uninitialised value of size 8 ==12013== at 0x4006F3: virtual thunk to Main::foo() (in /home/smatz/gcc-bug/1256/a.out) ==12013== by 0x400517: main (in /home/smatz/gcc-bug/1256/a.out) ==12013== Uninitialised value was created by a stack allocation ==12013== at 0x400500: main (in /home/smatz/gcc-bug/1256/a.out) ==12013== ==12013== Invalid read of size 8 ==12013== at 0x4006F3: virtual thunk to Main::foo() (in /home/smatz/gcc-bug/1256/a.out) ==12013== by 0x400517: main (in /home/smatz/gcc-bug/1256/a.out) ==12013== Address 0xffffffffffffffe8 is not stack'd, malloc'd or (recently) free'd ==12013== ==12013== ==12013== Process terminating with default action of signal 11 (SIGSEGV) ==12013== Access not within mapped region at address 0xFFFFFFFFFFFFFFE8 ==12013== at 0x4006F3: virtual thunk to Main::foo() (in /home/smatz/gcc-bug/1256/a.out) ==12013== by 0x400517: main (in /home/smatz/gcc-bug/1256/a.out) $ g++-4_8-r210303 -O2 p4736b.ii $ valgrind -q --track-origins=yes ./a.out ==12047== Use of uninitialised value of size 8 ==12047== at 0x4006C3: virtual thunk to Main::foo() (in /home/smatz/gcc-bug/1256/a.out) ==12047== by 0x400517: main (in /home/smatz/gcc-bug/1256/a.out) ==12047== Uninitialised value was created by a stack allocation ==12047== at 0x400500: main (in /home/smatz/gcc-bug/1256/a.out) ==12047== ==12047== Invalid read of size 8 ==12047== at 0x4006C3: virtual thunk to Main::foo() (in /home/smatz/gcc-bug/1256/a.out) ==12047== by 0x400517: main (in /home/smatz/gcc-bug/1256/a.out) ==12047== Address 0xffffffffffffffe8 is not stack'd, malloc'd or (recently) free'd ==12047== ==12047== ==12047== Process terminating with default action of signal 11 (SIGSEGV) ==12047== Access not within mapped region at address 0xFFFFFFFFFFFFFFE8 ==12047== at 0x4006C3: virtual thunk to Main::foo() (in /home/smatz/gcc-bug/1256/a.out) ==12047== by 0x400517: main (in /home/smatz/gcc-bug/1256/a.out) $ g++-4_7-r210302 -O2 p4736b.ii $ valgrind -q --track-origins=yes ./a.out ==12072== Use of uninitialised value of size 8 ==12072== at 0x4006C3: virtual thunk to Main::foo() (in /home/smatz/gcc-bug/1256/a.out) ==12072== by 0x400511: main (in /home/smatz/gcc-bug/1256/a.out) ==12072== Uninitialised value was created by a stack allocation ==12072== at 0x400500: main (in /home/smatz/gcc-bug/1256/a.out) ==12072== ==12072== Use of uninitialised value of size 8 ==12072== at 0x4006C3: virtual thunk to Main::foo() (in /home/smatz/gcc-bug/1256/a.out) ==12072== by 0x40052B: main (in /home/smatz/gcc-bug/1256/a.out) ==12072== Uninitialised value was created by a stack allocation ==12072== at 0x400500: main (in /home/smatz/gcc-bug/1256/a.out) ==12072== ==12072== Use of uninitialised value of size 8 ==12072== at 0x4006D7: virtual thunk to Main::foo() (in /home/smatz/gcc-bug/1256/a.out) ==12072== by 0x40053F: main (in /home/smatz/gcc-bug/1256/a.out) ==12072== Uninitialised value was created by a stack allocation ==12072== at 0x400500: main (in /home/smatz/gcc-bug/1256/a.out) ==12072== ==12072== Use of uninitialised value of size 8 ==12072== at 0x4006E7: virtual thunk to Main::foo() (in /home/smatz/gcc-bug/1256/a.out) ==12072== by 0x400553: main (in /home/smatz/gcc-bug/1256/a.out) ==12072== Uninitialised value was created by a stack allocation ==12072== at 0x400500: main (in /home/smatz/gcc-bug/1256/a.out) ==12072== $ g++-4_6-r197894 -O2 p4736b.ii $ valgrind -q --track-origins=yes ./a.out (no output) The code seems valid and defined to me, but somebody else might know otherwise. I haven't analysed whether messages output by valgrind for gcc 4.7 are valid or just false positives. Tested revisions: trunk r210412 - SIGSEGV 4_9 r210307 - SIGSEGV 4_8 r210303 - SIGSEGV 4_7 r210302 - valgrind warnings, but no crash 4_6 r197894 - OK