http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48770
Summary: [4.7 Regression] wrong code with -O -fprofile-arcs -fPIC -fno-dce -fno-forward-propagate -fno-tree-forwprop Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end AssignedTo: unassig...@gcc.gnu.org ReportedBy: zso...@seznam.cz Host: x86_64-pc-linux-gnu Target: x86_64-pc-linux-gnu Created attachment 24101 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24101 reduced testcase (from g++.dg/bprob/g++-bprob-1.C) Compiler output: $ rm *.gcda $ g++ -O -fprofile-arcs -fPIC -fno-dce -fno-forward-propagate -fno-tree-forwprop testcase.C $ valgrind -q ./a.out ==5350== Invalid read of size 8 ==5350== at 0x400D51: test_goto2(int) (testcase.C:10) ==5350== by 0x400D7E: main (testcase.C:14) ==5350== Address 0x8 is not stack'd, malloc'd or (recently) free'd Segmentation fault Fails only when compiled as C++ code. Tested revisions: r172940 - fail 4.6 r172337 - OK