xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.base/watch-bitfields.c (revision c38e7cc395b1472a774ff828e46123de44c628e9)
1 /* This testcase is part of GDB, the GNU debugger.
2 
3    Copyright 2014-2016 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 struct foo
19 {
20   unsigned long a:1;
21   unsigned char b:2;
22   unsigned long c:3;
23   char d:4;
24   int e:5;
25   char f:6;
26   int g:7;
27   long h:8;
28 } q = { 0 };
29 
30 int
31 main (void)
32 {
33   q.a = 1;
34   q.b = 2;
35   q.c = 3;
36   q.d = 4;
37   q.e = 5;
38   q.f = 6;
39   q.g = -7;
40   q.h = -8;
41   q.a--;
42   q.h--;
43   q.c--;
44   q.b--;
45   q.e--;
46   q.d--;
47   q.c--;
48   q.f--;
49   q.g--;
50   q.h--;
51 
52 
53   return 0;
54 }
55