]>
Commit | Line | Data |
---|---|---|
f7e5394d SM |
1 | /* This testcase is part of GDB, the GNU debugger. |
2 | ||
3666a048 | 3 | Copyright 2015-2021 Free Software Foundation, Inc. |
f7e5394d SM |
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 | struct inner | |
19 | { | |
20 | int a; | |
21 | }; | |
22 | ||
23 | struct outer | |
24 | { | |
25 | struct inner *inner; | |
26 | }; | |
27 | ||
28 | int main (void) | |
29 | { | |
30 | struct inner inner; | |
31 | struct outer outer; | |
32 | struct outer *p_outer; | |
33 | ||
34 | inner.a = 42; | |
35 | outer.inner = &inner; | |
36 | ||
37 | /* We force p_outer to an invalid value, but this also happens naturally | |
38 | * when a variable has not been initialized. */ | |
39 | ||
40 | p_outer = 0; | |
41 | /* p_outer set to invalid value */ | |
42 | p_outer = &outer; | |
43 | /* p_outer set to valid value */ | |
44 | ||
45 | return 0; | |
46 | } |