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

            Bug ID: 94300
           Summary: [10 Regression] memcpy vector load miscompiled during
                    const-prop
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kretz at kde dot org
  Target Milestone: ---
            Target: x86_64-*-*, i?86-*-*

Test case `-O1 -march=skylake-avx512`:

int main()                                                                      
{                                                                               
  double mem[16];                                                               
  using V [[gnu::vector_size(64)]] = double;                                    
  const V a{0, 1, 2, 3, 4, 5, 6, 7};                                            
  const V b{8, 9, 10, 11, 12, 13, 14, 15};                                      
  __builtin_memcpy(mem, &a, 64);                                                
  __builtin_memcpy(mem + 8, &b, 64);                                            
  V c = {};                                                                     
  __builtin_memcpy(&c, mem + 4, 64);                                            
  if (c[5] != double(9))                                                        
    __builtin_abort();                                                          
}

>From my extended test case, where c would be {4, 5, 6, 7, 8, 15, 9, 10}. If GCC
is made to forget the contents of mem (e.g. inline-asm), the test does not
fail. GCC9 does not do constant evaluation of the code above and therefore
doesn't fail.

Reply via email to