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

            Bug ID: 68143
           Summary: [5/6 Regression][ARM] Wrong code initialising struct
                    member after zeroing out the whole struct
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
  Target Milestone: ---
            Target: arm

The testcase:
#define NULL 0

struct stuff
{ 
    int a;
    int b;
    int c;
    int d;
    int e;
    char *f;
    int g;
};

void __attribute__ ((noinline))
bar (struct stuff *x)
{
  if (x->g != 2)
    __builtin_abort ();
}

void
main (int argc, char** argv)
{
  struct stuff x = {0, 0, 0, 0, 0, NULL, 0};
  x.a = 100;
  x.d = 100;
  x.g = 2;
  /* Struct should now look like {100, 0, 0, 100, 0, 0, 0, 2}.  */
  bar (&x);
}


fails on arm targets with options:
 -O3  -mcpu=cortex-a57 -mfpu=neon-fp-armv8 -mfloat-abi=hard

The compiler does the initial zeroing-out of the struct using two vst
instructions but the initialisation of the 'g' field to 2 gets move before
them.

The setmem expansion in arm_block_set_aligned_vect is suspect.

Reply via email to