1 /* This testcase is part of GDB, the GNU debugger.
2 
3    Copyright (C) 2018-2020 Free Software Foundation, Inc.
4 
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License as published by
7    the Free Software Foundation; either version 3 of the License, or
8    (at your option) any later version.
9 
10    This program is distributed in the hope that it will be useful,
11    but WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13    GNU General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License
16    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
17 
18 enum cons_type
19 {
20   type_atom = 0,
21   type_cons = 1
22 };
23 
24 struct atom
25 {
26   int ival;
27 };
28 
29 struct cons
30 {
31   enum cons_type type;
32   union
33   {
34     struct atom atom;
35     struct cons *slots[2];
36   };
37 };
38 
39 #define nil ((struct cons*)0);
40 
41 int
main()42 main ()
43 {
44   struct cons c1, c2, c3, c4;
45 
46   c1.type = type_cons;
47   c1.slots[0] = &c4;
48   c1.slots[1] = &c2;
49 
50   c2.type = type_cons;
51   c2.slots[0] = nil;
52   c2.slots[1] = &c3;
53 
54   c3.type = type_cons;
55   c3.slots[0] = nil;
56   c3.slots[1] = nil;
57 
58   c4.type = type_atom;
59   c4.atom.ival = 13;
60 
61   return 0;			/* next line */
62 }
63