summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/pr39343.c
blob: 70df59ef098491bc65e55de9ab75f7cdf3a8b348 (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
/* PR tree-optimization/39343 */
/* { dg-do run } */
/* { dg-options "-O2" } */

extern void abort (void);

extern inline __attribute__ ((__always_inline__)) int
foo (char *dest)
{
  return __builtin_object_size (dest, 1);
}

struct S
{
  union
  {
    struct { int a, b; char c, d; } f;
    struct { struct { int a, b; char c, d[255]; } e; } g;
  } u;
};

int
main (void)
{
  struct S s;
  if (foo (s.u.g.e.d) != 255)
    abort ();
  return 0;
}