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

            Bug ID: 89965
           Summary: [9 Regression] wrong code with -O -mtune=nano-x2
                    -fcaller-saves -fexpensive-optimizations -fno-tree-dce
                    -fno-tree-ter
           Product: gcc
           Version: 9.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: i686-pc-linux-gnu

Created attachment 46088
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46088&action=edit
reduced testcase

Output:
$ i686-pc-linux-gnu-gcc -O -mtune=nano-x2 -fcaller-saves
-fexpensive-optimizations -fno-tree-dce -fno-tree-ter testcase.c
$ ./a.out 
Aborted

$ i686-pc-linux-gnu-gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest-i686/bin/i686-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-270111-checking-yes-rtl-df-extra-i686/bin/../libexec/gcc/i686-pc-linux-gnu/9.0.1/lto-wrapper
Target: i686-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 --with-sysroot=/usr/i686-pc-linux-gnu
--build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu
--target=i686-pc-linux-gnu --with-ld=/usr/bin/i686-pc-linux-gnu-ld
--with-as=/usr/bin/i686-pc-linux-gnu-as --disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-270111-checking-yes-rtl-df-extra-i686
Thread model: posix
gcc version 9.0.1 20190403 (experimental) (GCC) 


It seems this value [esp]:
...
# testcase.c:16:   c *= i;
        movzx   esi, BYTE PTR [esp]     # _3,
        mov     eax, ebp        # c, c
        mov     edx, esi        # _3, _3
        imul    eax, edx        # c, _3
        mov     ebp, eax        # c, c
...

is used uninitialized

Reply via email to