https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69252
Bug ID: 69252 Summary: [4.9/5/6 Regression] gcc.dg/vect/vect-iv-9.c FAILs with -Os -fmodulo-sched -fmodulo-sched-allow-regmoves -fsched-pressure Product: gcc Version: 6.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: zsojka at seznam dot cz Target Milestone: --- Host: x86_64-pc-linux-gnu Target: powerpc64-unknown-linux-gnu Created attachment 37319 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37319&action=edit reduced testcase Output (qemu userspace emulation used): $ powerpc64-unknown-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=/repo/gcc-trunk/binary-trunk-232261-checking-yes-rtl-df-nographite-powerpc64/bin/powerpc64-unknown-linux-gnu-gcc COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-232261-checking-yes-rtl-df-nographite-powerpc64/bin/../libexec/gcc/powerpc64-unknown-linux-gnu/6.0.0/lto-wrapper Target: powerpc64-unknown-linux-gnu Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++ --enable-checking=yes,rtl,df --without-cloog --without-ppl --without-isl --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=powerpc64-unknown-linux-gnu --with-ld=/usr/bin/powerpc64-unknown-linux-gnu-ld --with-as=/usr/bin/powerpc64-unknown-linux-gnu-as --with-sysroot=/usr/powerpc64-unknown-linux-gnu --disable-multilib --disable-libstdcxx-pch --prefix=/repo/gcc-trunk//binary-trunk-232261-checking-yes-rtl-df-nographite-powerpc64 Thread model: posix gcc version 6.0.0 20160112 (experimental) (GCC) $ powerpc64-unknown-linux-gnu-gcc -Os -fmodulo-sched -fmodulo-sched-allow-regmoves -fsched-pressure testcase.c $ ./a.out qemu: uncaught target signal 6 (Aborted) - core dumped Aborted Only powerpc64 seems to be affected. The wrong code seems to be: .L.main1: li 9,0 addis 5,2,.LC1@toc@ha # gpr load fusion, type long ld 5,.LC1@toc@l(5) li 10,24 mtctr 10 sldi 6,9,2 lwzx 10,5,6 addi 9,9,1 sldi 6,9,2 add 7,10,8 mr 8,9 ... r8 is used uninitialised here (it has value 25 set by the caller). r8 always stores the value of r9 from the previous iteration, but here, it is unset. Something like: @@ -21,6 +21,7 @@ li 10,24 mtctr 10 sldi 6,9,2 + mr 8,9 lwzx 10,5,6 addi 9,9,1 sldi 6,9,2 would fix the example. The code emitted without -fmodulo-sched-allow-regmoves is much smaller (the partial unrolling is not done). Tested revisions: trunk r232261 - FAIL 5-branch r232254 - FAIL 4_9-branch r232213 - FAIL 4_8-branch r224828 - FAIL 4_7-branch r211571 - OK 4_6-branch r197894 - OK 4_5-branch r189152 - OK