| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-Wcast-align=strict" } */ |
| 3 |
|
| 4 |
typedef char __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) c; |
| 5 |
typedef struct __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__))) |
| 6 |
{ |
| 7 |
char x; |
| 8 |
} d; |
| 9 |
|
| 10 |
char *x; |
| 11 |
c *y; |
| 12 |
d *z; |
| 13 |
struct s { long long x; } *p; |
| 14 |
struct t { double x; } *q; |
| 15 |
|
| 16 |
void |
| 17 |
foo (void) |
| 18 |
{ |
| 19 |
y = (c *) x; /* { dg-warning "7:cast \[^\n\r]* required alignment of target type" "" { target { ! no_alignment_constraints } } } */ |
| 20 |
z = (d *) x; /* { dg-warning "7:cast \[^\n\r]* required alignment of target type" "" { target { ! no_alignment_constraints } } } */ |
| 21 |
(long long *) p; /* { dg-bogus "alignment" } */ |
| 22 |
(double *) q; /* { dg-bogus "alignment" } */ |
| 23 |
} |