1 /* Check that GDB can correctly update a value, living in a register,
2 in the target. This pretty much relies on the compiler taking heed
3 of requests for values to be stored in registers. */
5 /* NOTE: carlton/2002-12-05: These functions were all static, but for
6 whatever reason that caused GCC 3.1 to optimize away some of the
7 function calls within main even when no optimization flags were
10 typedef signed char charest
;
13 add_charest (register charest u
, register charest v
)
19 add_short (register short u
, register short v
)
25 add_int (register int u
, register int v
)
31 add_long (register long u
, register long v
)
36 typedef long long longest
;
39 add_longest (register longest u
, register longest v
)
45 add_float (register float u
, register float v
)
51 add_double (register double u
, register double v
)
56 typedef long double doublest
;
59 add_doublest (register doublest u
, register doublest v
)
67 wack_charest (register charest u
, register charest v
)
69 register charest l
= u
, r
= v
;
70 l
= add_charest (l
, r
);
75 wack_short (register short u
, register short v
)
77 register short l
= u
, r
= v
;
83 wack_int (register int u
, register int v
)
85 register int l
= u
, r
= v
;
91 wack_long (register long u
, register long v
)
93 register long l
= u
, r
= v
;
99 wack_longest (register longest u
, register longest v
)
101 register longest l
= u
, r
= v
;
102 l
= add_longest (l
, r
);
107 wack_float (register float u
, register float v
)
109 register float l
= u
, r
= v
;
110 l
= add_float (l
, r
);
115 wack_double (register double u
, register double v
)
117 register double l
= u
, r
= v
;
118 l
= add_double (l
, r
);
123 wack_doublest (register doublest u
, register doublest v
)
125 register doublest l
= u
, r
= v
;
126 l
= add_doublest (l
, r
);
132 struct s_1
{ short s
[1]; } z_1
, s_1
;
133 struct s_2
{ short s
[2]; } z_2
, s_2
;
134 struct s_3
{ short s
[3]; } z_3
, s_3
;
135 struct s_4
{ short s
[4]; } z_4
, s_4
;
138 add_struct_1 (struct s_1 s
)
141 for (i
= 0; i
< sizeof (s
) / sizeof (s
.s
[0]); i
++)
143 s
.s
[i
] = s
.s
[i
] + s
.s
[i
];
149 add_struct_2 (struct s_2 s
)
152 for (i
= 0; i
< sizeof (s
) / sizeof (s
.s
[0]); i
++)
154 s
.s
[i
] = s
.s
[i
] + s
.s
[i
];
160 add_struct_3 (struct s_3 s
)
163 for (i
= 0; i
< sizeof (s
) / sizeof (s
.s
[0]); i
++)
165 s
.s
[i
] = s
.s
[i
] + s
.s
[i
];
171 add_struct_4 (struct s_4 s
)
174 for (i
= 0; i
< sizeof (s
) / sizeof (s
.s
[0]); i
++)
176 s
.s
[i
] = s
.s
[i
] + s
.s
[i
];
184 int i
; register struct s_1 u
= z_1
;
185 for (i
= 0; i
< sizeof (s_1
) / sizeof (s_1
.s
[0]); i
++) { s_1
.s
[i
] = i
+ 1; }
186 u
= add_struct_1 (u
);
193 int i
; register struct s_2 u
= z_2
;
194 for (i
= 0; i
< sizeof (s_2
) / sizeof (s_2
.s
[0]); i
++) { s_2
.s
[i
] = i
+ 1; }
195 u
= add_struct_2 (u
);
202 int i
; register struct s_3 u
= z_3
;
203 for (i
= 0; i
< sizeof (s_3
) / sizeof (s_3
.s
[0]); i
++) { s_3
.s
[i
] = i
+ 1; }
204 u
= add_struct_3 (u
);
211 int i
; register struct s_4 u
= z_4
;
212 for (i
= 0; i
< sizeof (s_4
) / sizeof (s_4
.s
[0]); i
++) { s_4
.s
[i
] = i
+ 1; }
213 u
= add_struct_4 (u
);
219 struct f_1
{unsigned i
:1;unsigned j
:1;unsigned k
:1; } f_1
= {1,1,1}, F_1
;
220 struct f_2
{unsigned i
:2;unsigned j
:2;unsigned k
:2; } f_2
= {1,1,1}, F_2
;
221 struct f_3
{unsigned i
:3;unsigned j
:3;unsigned k
:3; } f_3
= {1,1,1}, F_3
;
222 struct f_4
{unsigned i
:4;unsigned j
:4;unsigned k
:4; } f_4
= {1,1,1}, F_4
;
227 register struct f_1 u
= f_1
;
234 register struct f_2 u
= f_2
;
241 register struct f_3 u
= f_3
;
248 register struct f_4 u
= f_4
;
257 /* These calls are for current frame test. */
258 wack_charest (-1, -2);
262 wack_longest (-1, -2);
264 wack_double (-1, -2);
265 wack_doublest (-1, -2);
267 /* These calls are for up frame. */
268 wack_charest (-1, -2);
272 wack_longest (-1, -2);
274 wack_double (-1, -2);
275 wack_doublest (-1, -2);
277 /* These calls are for current frame test. */
283 /* These calls are for up frame. */
This page took 0.039174 seconds and 4 git commands to generate.