xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.stabs/gdb11479.c (revision 8b657b0747480f8989760d71343d6dd33f8d4cf9)
1 /* This testcase is part of GDB, the GNU debugger.
2 
3    Copyright 2010-2023 Free Software Foundation, Inc.
4 
5    Contributed by Pierre Muller.
6 
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11 
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16 
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 
20    Qualifiers of forward types are not resolved correctly with stabs.  */
21 
22 struct dummy;
23 
24 enum dummy_enum;
25 
26 /* This function prevents the compiler from dropping local variables
27    we need for the test.  */
28 void *hack (const struct dummy *t, const enum dummy_enum *e);
29 
30 const void *
31 test (const struct dummy *t)
32 {
33   const struct dummy *tt;
34   enum dummy_enum *e;
35   tt = t;
36   return hack (t, e);
37 }
38 
39 void *
40 test2 (struct dummy *t)
41 {
42   struct dummy *tt;
43   const enum dummy_enum *e;
44   tt = t;
45   return hack (t, e);
46 }
47 
48 
49 struct dummy {
50  int x;
51  int y;
52  double b;
53 } tag_dummy;
54 
55 enum dummy_enum {
56   enum1,
57   enum2
58 } tag_dummy_enum;
59 
60 void *
61 hack (const struct dummy *t, const enum dummy_enum *e)
62 {
63   return (void *) t;
64 }
65 
66 int
67 main ()
68 {
69   struct dummy tt;
70   tt.x = 5;
71   tt.y = 25;
72   tt.b = 2.5;
73   test2 (&tt);
74   test (&tt);
75   return 0;
76 }
77