[Bug rtl-optimization/89815] New: [7/8/9 Regression] wrong code with -Og -march=armv4t -fno-tree-ccp -fno-tree-fre

zsojka at seznam dot cz gcc-bugzilla@gcc.gnu.org
Mon Mar 25 12:28:00 GMT 2019


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89815

            Bug ID: 89815
           Summary: [7/8/9 Regression] wrong code with -Og -march=armv4t
                    -fno-tree-ccp -fno-tree-fre
           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 46017
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46017&action=edit
reduced testcase

Output:
$ armv7a-hardfloat-linux-gnueabi-gcc -Og -march=armv4t -fno-tree-ccp
-fno-tree-fre testcase.c -static
$ ./a.out
qemu: uncaught target signal 6 (Aborted) - core dumped
Aborted

Correct value is 0xff, wrong value is 0xffffffff. The wrong value seems to be
generated by the instruction:

...
@ testcase.c:10:   b = __builtin_sub_overflow (0xff, (u8) - d, &f);
        mvn     r4, #0  @ tmp143,
...

$ 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-269905-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-269905-checking-yes-rtl-df-extra-armv7a-hardfloat
Thread model: posix
gcc version 9.0.1 20190325 (experimental) (GCC) 


The .ira dump has:
...
(insn 55 24 32 2 (set (reg:QI 145 [143])
        (const_int -1 [0xffffffffffffffff])) "testcase.c":10:7 191
{*arm_movqi_insn}
     (nil))
...
(insn 58 43 47 2 (set (reg:QI 143)
        (reg:QI 145 [143])) "testcase.c":13:1 191 {*arm_movqi_insn}
     (expr_list:REG_DEAD (reg:QI 145 [143])
        (nil)))
(insn 47 58 48 2 (set (reg/i:SI 0 r0)
        (subreg:SI (reg:QI 143) 0)) "testcase.c":13:1 654 {*arm_movsi_vfp}
     (expr_list:REG_DEAD (reg:QI 143)
        (nil)))
...

And the .reload dump has:
...
(insn 55 24 32 2 (set (reg:QI 4 r4 [143])
        (const_int -1 [0xffffffffffffffff])) "testcase.c":10:7 191
{*arm_movqi_insn}
     (nil))
...
(insn 58 43 48 2 (set (reg:QI 0 r0 [143])
        (reg:QI 4 r4 [143])) "testcase.c":13:1 191 {*arm_movqi_insn}
     (nil))
...


More information about the Gcc-bugs mailing list