https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89794
Bug ID: 89794
Summary: wrong code with -Og -fno-forward-propagate
Product: gcc
Version: 9.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: armv7a-hardfloat-linux-gnueabi
Created attachment 46010
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46010&action=edit
reduced testcase
Output:
$ armv7a-hardfloat-linux-gnueabi-gcc -Og -fno-forward-propagate testcase.c
-static
$ ./a.out
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
Segmentation fault
The instruction:
...
@ testcase.c:12: __builtin_memset (&i, c, 2);
movw r1, #:lower16:c @ tmp132,
movt r1, #:upper16:c @ tmp132,
ldr ip, [r1] @ c.2_7, c
uxtb r3, ip @ c.2_7, c.2_7
add r3, r3, r3, lsl #8 @ tmp140, c.2_7, c.2_7,
strh r3, [sp] @ movhi @ tmp140, MEM[(void *)&i]
overwrites return address
$ armv7a-hardfloat-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-armv7a-hardfloat/bin/armv7a-hardfloat-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-269795-checking-yes-rtl-df-extra-armv7a-hardfloat/bin/../libexec/gcc/armv7a-hardfloat-linux-gnueabi/9.0.1/lto-wrapper
Target: armv7a-hardfloat-linux-gnueabi
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 --with-float=hard --with-fpu=vfpv4
--with-arch=armv7-a --with-sysroot=/usr/armv7a-hardfloat-linux-gnueabi
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=armv7a-hardfloat-linux-gnueabi
--with-ld=/usr/bin/armv7a-hardfloat-linux-gnueabi-ld
--with-as=/usr/bin/armv7a-hardfloat-linux-gnueabi-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-269795-checking-yes-rtl-df-extra-armv7a-hardfloat
Thread model: posix
gcc version 9.0.1 20190319 (experimental) (GCC)