view gcc/testsuite/c-c++-common/Wcast-align.c @ 131:84e7813d76e9

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

/* { dg-do compile } */
/* { dg-options "-Wcast-align=strict" } */

typedef char __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) c;
typedef struct __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)))
{
  char x;
} d;

char *x;
c *y;
d *z;
struct s { long long x; } *p;
struct t { double x; } *q;

void
foo (void)
{
  y = (c *) x;  /* { dg-warning "alignment" } */
  z = (d *) x;  /* { dg-warning "alignment" } */
  (long long *) p;  /* { dg-bogus "alignment" } */
  (double *) q;     /* { dg-bogus "alignment" } */
}