aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/pr51628-26.c
blob: 5ca381dba5d31e3884901c2f785a0361a884deed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* PR c/51628.  */
/* { dg-do compile } */
/* { dg-options "-O" } */

struct A {
  int i;
} __attribute__ ((packed));

struct A p = {1};
int *addr;

int i, j;

void
foo1 (void)
{
  addr = (i = -1, &p.i);
/* { dg-warning "may result in an unaligned pointer value" "" { target { ! default_packed } } .-1 } */
}

void
foo2 (void)
{
  addr = (i = -1, j = -2, &p.i);
/* { dg-warning "may result in an unaligned pointer value" "" { target { ! default_packed } } .-1 } */
}

void
foo3 (void)
{
  addr = (i = -1, (j = -2, &p.i));
/* { dg-warning "may result in an unaligned pointer value" "" { target { ! default_packed } } .-1 } */
}