This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/70574] New: [5/6 Regression] wrong code with -mavx2, read of partially initialised stack variable


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

            Bug ID: 70574
           Summary: [5/6 Regression] wrong code with -mavx2, read of
                    partially initialised stack variable
           Product: gcc
           Version: unknown
            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: ---
            Target: x86_64-pc-linux-gnu

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

Output:
$ gcc -O -fPIC -frerun-cse-after-loop -fno-tree-ccp -mcmodel=medium -mavx2
testcase.c
$ valgrind -q ./a.out
==1282== Conditional jump or move depends on uninitialised value(s)
==1282==    at 0x400653: main (in /home/zso/gcc-bug/89/a.out)
==1282== 
Aborted


The problem most likely is (intel sytax):
...
foo:
...
        mov     DWORD PTR -52[rbp], edi # %sfp, u64_0
        mov     QWORD PTR -64[rbp], rcx # %sfp, u128_1
1)      mov     BYTE PTR -48[rbp], -1   # %sfp,
        vpxor   xmm2, xmm2, xmm2        # tmp120
2)      vpinsrb xmm2, xmm2, BYTE PTR -48[rbp], 1        # tmp120, tmp120, %sfp,
        vmovd   xmm4, DWORD PTR -64[rbp]        # tmp124, %sfp
        mov     eax, 0  # tmp126,
        vpinsrb xmm4, xmm4, eax, 1      # tmp125, tmp124, tmp126,
3)      vmovd   xmm3, DWORD PTR -48[rbp]        # tmp129, %sfp
...

1 stores a "byte" -1, 2 reads "byte" -1, 3 reads "dword" -1 (3 bytes of
garbage)


$ gcc -v
Using built-in specs.
COLLECT_GCC=/repo/gcc-trunk/binary-latest/bin/x86_64-pc-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-234794-checking-yes-rtl-df-nographite/bin/../libexec/gcc/x86_64-pc-linux-gnu/6.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++
--enable-checking=yes,rtl,df --without-cloog --without-ppl --without-isl
--disable-libstdcxx-pch
--prefix=/repo/gcc-trunk//binary-trunk-234794-checking-yes-rtl-df-nographite
Thread model: posix
gcc version 6.0.0 20160406 (experimental) (GCC)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]