https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93170
Bug ID: 93170 Summary: [10 Regression] wrong code due to use of a call-clobbered register Product: gcc Version: 10.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: zsojka at seznam dot cz Target Milestone: --- Host: x86_64-pc-linux-gnu Target: x86_64-pc-linux-gnu Created attachment 47595 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47595&action=edit reduced testcase Output: $ x86_64-pc-linux-gnu-gcc -O2 -frename-registers -fno-tree-forwprop -fno-tree-fre -fira-algorithm=priority -mstringop-strategy=loop --param=hot-bb-frequency-fraction=0 testcase.c -Wno-psabi $ ./a.out Aborted In the assembly output: ... # testcase.c:17: d = __builtin_popcountll (-((v64u8) i)[0]); movsx rdi, esi # tmp233, tmp232 mov QWORD PTR [rsp+32], r10 # %sfp, _70 mov QWORD PTR [rsp+40], r11 # %sfp, _70 mov QWORD PTR [rsp+16], rbx # %sfp, _67 call __popcountdi2 # ... # testcase.c:16: j >>= ((v64u128) h <= j); shrd r12, rsi, cl # tmp254,, tmp253 xor ebx, ebx # # testcase.c:18: return a + g + j; mov QWORD PTR [rsp+128], rax #, tmp251 # testcase.c:16: j >>= ((v64u128) h <= j); shr rsi, cl #, tmp253 ... The __popcountdi2 call clobbers rsi, and the caller uses the clobbered value. $ x86_64-pc-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-279889-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/10.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++ --enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra --with-cloog --with-ppl --with-isl --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld --with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch --prefix=/repo/gcc-trunk//binary-trunk-279889-checking-yes-rtl-df-extra-amd64 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 10.0.0 20200105 (experimental) (GCC)