summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/tree-ssa/pr22615.C
blob: a8936c4cb6507108c6727b830ca8d3eeb549cac8 (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
/* { dg-do compile } */
/* { dg-options "-O2" } */

/* Ensure that we don't crash when people decide to return the address of padding.  */

struct A
{
    char c;
      int i;
};

A a;

struct B
{
    char c, d;
};

union C
{
    A *p;
      B *q;

        C() : p(&a) {}
	  char& foo() { return q->d; }
};
void bar() { C().foo() = 0; }