summaryrefslogtreecommitdiff
path: root/support/regression/tests/gcc-torture-execute-anon-1.c
blob: e6f43609f38c5f90d6de5578734ea69393b4f19b (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
34
35
36
37
38
39
40
41
42
/*
   anon-1.c from the execute part of the gcc torture tests.
 */

#include <testfwk.h>

#ifdef __SDCC
#pragma std_c11

/* Copyright (C) 2001 Free Software Foundation, Inc.  */

/* Source: Neil Booth, 4 Nov 2001, derived from PR 2820 - field lookup in
   nested anonymous entities was broken.  */

struct
{
  int x;
  struct
  {
    int a;
    union
    {
      int b;
    };
  };
} foo;
#endif

void
testTortureExecute (void)
{
#ifdef __SDCC
  foo.b = 6;
  foo.a = 5;

  if (foo.b != 6)
    ASSERT (0);

  return;
#endif
}