view gcc/testsuite/gcc.dg/misaligned-expand-1.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* Test that expand can generate correct loads of misaligned data even on
   strict alignment platforms.  */

/* { dg-do run } */
/* { dg-options "-O0" } */

extern void abort ();

typedef unsigned int myint __attribute__((aligned(1)));

unsigned int
foo (myint *p)
{
  return *p;
}

#define cst (int) 0xdeadbeef
#define NUM 8

struct blah
{
  char c;
  myint i[NUM];
};

struct blah g;

int
main (int argc, char **argv)
{
  int i, k;
  for (k = 0; k < NUM; k++)
    {
      g.i[k] = cst;
      i = foo (&g.i[k]);

      if (i != cst)
	abort ();
    }
  return 0;
}