]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/structs.exp
5c4d4adfdcd2087e40d4c39383dc19ca299107fb
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / structs.exp
1 # This testcase is part of GDB, the GNU debugger.
2
3 # Copyright 1996, 1997, 1999, 2003, 2004 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 2 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, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19 # Please email any bugs, comments, and/or additions to this file to:
20 # bug-gdb@prep.ai.mit.edu
21
22 if $tracelevel then {
23 strace $tracelevel
24 }
25
26 set prms_id 0
27 set bug_id 0
28
29 # Some targets can't call functions, so don't even bother with this
30 # test.
31
32 if [target_info exists gdb,cannot_call_functions] {
33 setup_xfail "*-*-*"
34 fail "This target can not call functions"
35 continue
36 }
37
38 set testfile "structs"
39 set srcfile ${testfile}.c
40 set binfile ${objdir}/${subdir}/${testfile}
41
42 # Create and source the file that provides information about the
43 # compiler used to compile the test case.
44
45 if [get_compiler_info ${binfile}] {
46 return -1;
47 }
48
49 # Compile a variant of structs.c using TYPES to specify the type of
50 # the first N struct elements (the remaining elements take the type of
51 # the last TYPES field). Run the compmiled program up to "main".
52 # Also updates the global "testfile" to reflect the most recent build.
53
54 proc start_structs_test { types } {
55 global testfile
56 global srcfile
57 global binfile
58 global objdir
59 global subdir
60 global srcdir
61 global gdb_prompt
62
63 # Create the additional flags
64 set flags "debug"
65 set testfile "structs"
66 set n 0
67 for {set n 0} {$n<[llength ${types}]} {incr n} {
68 set m [I2A ${n}]
69 set t [lindex ${types} $n]
70 lappend flags "additional_flags=-Dt${m}=${t}"
71 append testfile "-" "$t"
72 }
73
74 set binfile ${objdir}/${subdir}/${testfile}
75 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "${flags}"] != "" } {
76 # built the second test case since we can't use prototypes
77 warning "Prototypes not supported, rebuilding with -DNO_PROTOTYPES"
78 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable "${flags} additional_flags=-DNO_PROTOTYPES"] != "" } {
79 gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
80 }
81 }
82
83 # Start with a fresh gdb.
84 gdb_exit
85 gdb_start
86 gdb_reinitialize_dir $srcdir/$subdir
87 gdb_load ${binfile}
88
89 # Make certain that the output is consistent
90 gdb_test "set print sevenbit-strings" "" \
91 "set print sevenbit-strings; ${testfile}"
92 gdb_test "set print address off" "" \
93 "set print address off; ${testfile}"
94 gdb_test "set width 0" "" \
95 "set width 0; ${testfile}"
96
97 # Advance to main
98 if { ![runto_main] } then {
99 gdb_suppress_tests;
100 }
101
102 # Get the debug format
103 get_debug_format
104
105 # check that at the struct containing all the relevant types is correct
106 set foo_t "type = struct struct[llength ${types}] \{"
107 for {set n 0} {$n<[llength ${types}]} {incr n} {
108 append foo_t "\[\r\n \]+[lindex ${types} $n] [i2a $n];"
109 }
110 append foo_t "\[\r\n \]+\}"
111 gdb_test "ptype foo[llength ${types}]" "${foo_t}" \
112 "ptype foo[llength ${types}]; ${testfile}"
113 }
114
115 # The expected value for fun${n}, L${n} and foo${n}. First element is
116 # empty to make indexing easier. "foo" returns the modified value,
117 # "zed" returns the invalid value.
118
119 proc foo { n } {
120 return [lindex {
121 "{}"
122 "{a = 49 '1'}"
123 "{a = 97 'a', b = 50 '2'}"
124 "{a = 49 '1', b = 98 'b', c = 51 '3'}"
125 "{a = 97 'a', b = 50 '2', c = 99 'c', d = 52 '4'}"
126 "{a = 49 '1', b = 98 'b', c = 51 '3', d = 100 'd', e = 53 '5'}"
127 "{a = 97 'a', b = 50 '2', c = 99 'c', d = 52 '4', e = 101 'e', f = 54 '6'}"
128 "{a = 49 '1', b = 98 'b', c = 51 '3', d = 100 'd', e = 53 '5', f = 102 'f', g = 55 '7'}"
129 "{a = 97 'a', b = 50 '2', c = 99 'c', d = 52 '4', e = 101 'e', f = 54 '6', g = 103 'g', h = 56 '8'}"
130 "{a = 49 '1', b = 98 'b', c = 51 '3', d = 100 'd', e = 53 '5', f = 102 'f', g = 55 '7', h = 104 'h', i = 57 '9'}"
131 "{a = 97 'a', b = 50 '2', c = 99 'c', d = 52 '4', e = 101 'e', f = 54 '6', g = 103 'g', h = 56 '8', i = 105 'i', j = 65 'A'}"
132 "{a = 49 '1', b = 98 'b', c = 51 '3', d = 100 'd', e = 53 '5', f = 102 'f', g = 55 '7', h = 104 'h', i = 57 '9', j = 106 'j', k = 66 'B'}"
133 "{a = 97 'a', b = 50 '2', c = 99 'c', d = 52 '4', e = 101 'e', f = 54 '6', g = 103 'g', h = 56 '8', i = 105 'i', j = 65 'A', k = 107 'k', l = 67 'C'}"
134 "{a = 49 '1', b = 98 'b', c = 51 '3', d = 100 'd', e = 53 '5', f = 102 'f', g = 55 '7', h = 104 'h', i = 57 '9', j = 106 'j', k = 66 'B', l = 108 'l', m = 68 'D'}"
135 "{a = 97 'a', b = 50 '2', c = 99 'c', d = 52 '4', e = 101 'e', f = 54 '6', g = 103 'g', h = 56 '8', i = 105 'i', j = 65 'A', k = 107 'k', l = 67 'C', m = 109 'm', n = 69 'E'}"
136 "{a = 49 '1', b = 98 'b', c = 51 '3', d = 100 'd', e = 53 '5', f = 102 'f', g = 55 '7', h = 104 'h', i = 57 '9', j = 106 'j', k = 66 'B', l = 108 'l', m = 68 'D', n = 110 'n', o = 70 'F'}"
137 "{a = 97 'a', b = 50 '2', c = 99 'c', d = 52 '4', e = 101 'e', f = 54 '6', g = 103 'g', h = 56 '8', i = 105 'i', j = 65 'A', k = 107 'k', l = 67 'C', m = 109 'm', n = 69 'E', o = 111 'o', p = 71 'G'}"
138 "{a = 49 '1', b = 98 'b', c = 51 '3', d = 100 'd', e = 53 '5', f = 102 'f', g = 55 '7', h = 104 'h', i = 57 '9', j = 106 'j', k = 66 'B', l = 108 'l', m = 68 'D', n = 110 'n', o = 70 'F', p = 112 'p', q = 72 'H'}"
139 } $n]
140 }
141
142 proc zed { n } {
143 return [lindex {
144 "{}"
145 "{a = 90 'Z'}"
146 "{a = 90 'Z', b = 90 'Z'}"
147 "{a = 90 'Z', b = 90 'Z', c = 90 'Z'}"
148 "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z'}"
149 "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z'}"
150 "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z'}"
151 "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z'}"
152 "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z', h = 90 'Z'}"
153 "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z', h = 90 'Z', i = 90 'Z'}"
154 "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z', h = 90 'Z', i = 90 'Z', j = 90 'Z'}"
155 "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z', h = 90 'Z', i = 90 'Z', j = 90 'Z', k = 90 'Z'}"
156 "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z', h = 90 'Z', i = 90 'Z', j = 90 'Z', k = 90 'Z', l = 90 'Z'}"
157 "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z', h = 90 'Z', i = 90 'Z', j = 90 'Z', k = 90 'Z', l = 90 'Z', m = 90 'Z'}"
158 "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z', h = 90 'Z', i = 90 'Z', j = 90 'Z', k = 90 'Z', l = 90 'Z', m = 90 'Z', n = 90 'Z'}"
159 "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z', h = 90 'Z', i = 90 'Z', j = 90 'Z', k = 90 'Z', l = 90 'Z', m = 90 'Z', n = 90 'Z', o = 90 'Z'}"
160 "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z', h = 90 'Z', i = 90 'Z', j = 90 'Z', k = 90 'Z', l = 90 'Z', m = 90 'Z', n = 90 'Z', o = 90 'Z', p = 90 'Z'}"
161 "{a = 90 'Z', b = 90 'Z', c = 90 'Z', d = 90 'Z', e = 90 'Z', f = 90 'Z', g = 90 'Z', h = 90 'Z', i = 90 'Z', j = 90 'Z', k = 90 'Z', l = 90 'Z', m = 90 'Z', n = 90 'Z', o = 90 'Z', p = 90 'Z', q = 90 'Z'}"
162 } $n]
163 }
164
165 # Given N (0..25), return the corresponding alphabetic letter in lower
166 # or upper case. This is ment to be i18n proof.
167
168 proc i2a { n } {
169 return [string range "abcdefghijklmnopqrstuvwxyz" $n $n]
170 }
171
172 proc I2A { n } {
173 return [string toupper [i2a $n]]
174 }
175
176
177 # Use the file name, compiler and tuples to set up any needed KFAILs.
178
179 proc setup_kfails { file tuples bug } {
180 global testfile
181 if [string match $file $testfile] {
182 foreach f $tuples { setup_kfail $f $bug }
183 }
184 }
185
186 proc setup_compiler_kfails { file compiler format tuples bug } {
187 global testfile
188 if {[string match $file $testfile] && [test_compiler_info $compiler] && [test_debug_format $format]} {
189 foreach f $tuples { setup_kfail $f $bug }
190 }
191 }
192
193 # Test GDB's ability to make inferior function calls to functions
194 # returning (or passing in a single structs.
195
196 # N identifies the number of elements in the struct that will be used
197 # for the test case. FAILS is a list of target tuples that will fail
198 # this test.
199
200 # start_structs_test() will have previously built a program with a
201 # specified combination of types for those elements. To ensure
202 # robustness of the output, "p/c" is used.
203
204 # This tests the code paths "which return-value convention?" and
205 # "extract return-value from registers" called by "infcall.c".
206
207 proc test_struct_calls { n } {
208 global testfile
209 global gdb_prompt
210
211 # Check that GDB can always extract a struct-return value from an
212 # inferior function call. Since GDB always knows the location of an
213 # inferior function call's return value these should never fail
214
215 # Implemented by calling the parameterless function "fun$N" and then
216 # examining the return value printed by GDB.
217
218 set tests "call $n ${testfile}"
219
220 # Call fun${n}, checking the printed return-value.
221 setup_compiler_kfails structs-tc-* gcc-3-3 "DWARF 2" i*86-*-* gdb/1455
222 gdb_test "p/c fun${n}()" "[foo ${n}]" "p/c fun<n>(); ${tests}"
223
224 # Check that GDB can always pass a structure to an inferior function.
225 # This test can never fail.
226
227 # Implemented by calling the one parameter function "Fun$N" which
228 # stores its parameter in the global variable "L$N". GDB then
229 # examining that global to confirm that the value is as expected.
230
231 gdb_test "call Fun${n}(foo${n})" "" "call Fun<n>(foo<n>); ${tests}"
232 setup_compiler_kfails structs-tc-* gcc-3-3 "DWARF 2" i*86-*-* gdb/1455
233 gdb_test "p/c L${n}" [foo ${n}] "p/c L<n>; ${tests}"
234 }
235
236 # Test GDB's ability to both return a function (with "return" or
237 # "finish") and correctly extract/store any corresponding
238 # return-value.
239
240 # Check that GDB can consistently extract/store structure return
241 # values. There are two cases - returned in registers and returned in
242 # memory. For the latter case, the return value can't be found and a
243 # failure is "expected". However GDB must still both return the
244 # function and display the final source and line information.
245
246 # N identifies the number of elements in the struct that will be used
247 # for the test case. FAILS is a list of target tuples that will fail
248 # this test.
249
250 # This tests the code paths "which return-value convention?", "extract
251 # return-value from registers", and "store return-value in registers".
252 # Unlike "test struct calls", this test is expected to "fail" when the
253 # return-value is in memory (GDB can't find the location). The test
254 # is in three parts: test "return"; test "finish"; check that the two
255 # are consistent. GDB can sometimes work for one command and not the
256 # other.
257
258 proc test_struct_returns { n } {
259 global gdb_prompt
260 global testfile
261
262 set tests "return $n ${testfile}"
263
264
265 # Check that "return" works.
266
267 # GDB must always force the return of a function that has
268 # a struct result. Dependant on the ABI, it may, or may not be
269 # possible to store the return value in a register.
270
271 # The relevant code looks like "L{n} = fun{n}()". The test forces
272 # "fun{n}" to "return" with an explicit value. Since that code
273 # snippet will store the the returned value in "L{n}" the return
274 # is tested by examining "L{n}". This assumes that the
275 # compiler implemented this as fun{n}(&L{n}) and hence that when
276 # the value isn't stored "L{n}" remains unchanged. Also check for
277 # consistency between this and the "finish" case.
278
279 # Get into a call of fun${n}
280 gdb_test "advance fun${n}" \
281 "fun${n} .*\[\r\n\]+\[0-9\].*return foo${n}.*" \
282 "advance to fun<n> for return; ${tests}"
283
284 # Check that the program invalidated the relevant global.
285 gdb_test "p/c L${n}" " = [zed $n]" "zed L<n> for return; ${tests}"
286
287 # Force the "return". This checks that the return is always
288 # performed, and that GDB correctly reported this to the user.
289 # GDB 6.0 and earlier, when the return-value's location wasn't
290 # known, both failed to print a final "source and line" and misplaced
291 # the frame ("No frame").
292
293 # The test is writen so that it only reports one FAIL/PASS for the
294 # entire operation. The value returned is checked further down.
295 # "return_value_known", if non-zero, indicates that GDB knew where
296 # the return value was located.
297
298 set test "return foo<n>; ${tests}"
299 set return_value_known 1
300 set return_value_unimplemented 0
301 gdb_test_multiple "return foo${n}" "${test}" {
302 -re "The location" {
303 # Ulgh, a struct return, remember this (still need prompt).
304 set return_value_known 0
305 exp_continue
306 }
307 -re "A structure or union" {
308 # Ulgh, a struct return, remember this (still need prompt).
309 set return_value_known 0
310 # Double ulgh. Architecture doesn't use return_value and
311 # hence hasn't implemented small structure return.
312 set return_value_unimplemented 1
313 exp_continue
314 }
315 -re "Make fun${n} return now.*y or n. $" {
316 gdb_test_multiple "y" "${test}" {
317 -re "L${n} *= fun${n}.*${gdb_prompt} $" {
318 # Need to step off the function call
319 gdb_test "next" "L.* *= fun.*" "${test}"
320 }
321 -re "L[expr ${n} + 1] *= fun[expr ${n} + 1].*${gdb_prompt} $" {
322 pass "${test}"
323 }
324 }
325 }
326 }
327
328 # Check that the return-value is as expected. At this stage we're
329 # just checking that GDB has returned a value consistent with
330 # "return_value_known" set above.
331
332 set test "value foo<n> returned; ${tests}"
333 gdb_test_multiple "p/c L${n}" "${test}" {
334 -re " = [foo ${n}].*${gdb_prompt} $" {
335 if $return_value_known {
336 pass "${test}"
337 # This contradicts the above claim that GDB didn't
338 # know the location of the return-value.
339 } else {
340 fail "${test}"
341 }
342 }
343 -re " = [zed ${n}].*${gdb_prompt} $" {
344 if $return_value_known {
345 # This contradicts the above claim that GDB knew
346 # the location of the return-value.
347 fail "${test}"
348 } else {
349 # The struct return case. Since any modification
350 # would be by reference, and that can't happen, the
351 # value should be unmodified and hence Z is expected.
352 # Is this a reasonable assumption?
353 pass "${test}"
354 }
355 }
356 -re ".*${gdb_prompt} $" {
357 if $return_value_unimplemented {
358 # What a suprize. The architecture hasn't implemented
359 # return_value, and hence has to fail.
360 kfail "$test" gdb/1444
361 } else {
362 fail "$test"
363 }
364 }
365 }
366
367 # Check that a "finish" works.
368
369 # This is almost but not quite the same as "call struct funcs".
370 # Architectures can have subtle differences in the two code paths.
371
372 # The relevant code snippet is "L{n} = fun{n}()". The program is
373 # advanced into a call to "fun{n}" and then that function is
374 # finished. The returned value that GDB prints, reformatted using
375 # "p/c", is checked.
376
377 # Get into "fun${n}()".
378 gdb_test "advance fun${n}" \
379 "fun${n} .*\[\r\n\]+\[0-9\].*return foo${n}.*" \
380 "advance to fun<n> for finish; ${tests}"
381
382 # Check that the program invalidated the relevant global.
383 gdb_test "p/c L${n}" " = [zed $n]" "zed L<n> for finish; ${tests}"
384
385 # Finish the function, set 'finish_value_known" to non-empty if
386 # the return-value was found.
387
388 set test "finish foo<n>; ${tests}"
389 set finish_value_known 1
390 gdb_test_multiple "finish" "${test}" {
391 -re "Value returned is .*${gdb_prompt} $" {
392 pass "${test}"
393 }
394 -re "Cannot determine contents.*${gdb_prompt} $" {
395 # Expected bad value. For the moment this is ok.
396 set finish_value_known 0
397 pass "${test}"
398 }
399 }
400
401 # Re-print the last (return-value) using the more robust
402 # "p/c". If no return value was found, the 'Z' from the previous
403 # check that the variable was cleared, is printed.
404 set test "value foo<n> finished; ${tests}"
405 gdb_test_multiple "p/c" "${test}" {
406 -re "[foo ${n}]\[\r\n\]+${gdb_prompt} $" {
407 if $finish_value_known {
408 pass "${test}"
409 } else {
410 # This contradicts the above claim that GDB didn't
411 # know the location of the return-value.
412 fail "${test}"
413 }
414 }
415 -re "[zed ${n}]\[\r\n\]+${gdb_prompt} $" {
416 # The value didn't get found. This is "expected".
417 if $finish_value_known {
418 # This contradicts the above claim that GDB did
419 # know the location of the return-value.
420 fail "${test}"
421 } else {
422 pass "${test}"
423 }
424 }
425 }
426
427 # Finally, check that "return" and finish" have consistent
428 # behavior.
429
430 # Since "finish" works in more cases than "return" (see
431 # RETURN_VALUE_ABI_RETURNS_ADDRESS and
432 # RETURN_VALUE_ABI_PRESERVES_ADDRESS), the "return" value being
433 # known implies that the "finish" value is known (but not the
434 # reverse).
435
436 set test "return value known implies finish value known; ${tests}"
437 if {$return_value_known && ! $finish_value_known} {
438 kfail gdb/1444 "${test}"
439 } else {
440 pass "${test}"
441 }
442 }
443
444 # ABIs pass anything >8 or >16 bytes in memory but below that things
445 # randomly use register and/and structure conventions. Check all
446 # possible sized char structs in that range. But only a restricted
447 # range of the other types.
448
449 # NetBSD/PPC returns "unnatural" (3, 5, 6, 7) sized structs in memory.
450
451 # d10v is weird. 5/6 byte structs go in memory. 2 or more char
452 # structs go in memory. Everything else is in a register!
453
454 # Test every single char struct from 1..17 in size. This is what the
455 # original "structs" test was doing.
456
457 start_structs_test { tc }
458 test_struct_calls 1
459 test_struct_calls 2
460 test_struct_calls 3
461 test_struct_calls 4
462 test_struct_calls 5
463 test_struct_calls 6
464 test_struct_calls 7
465 test_struct_calls 8
466 test_struct_calls 9
467 test_struct_calls 10
468 test_struct_calls 11
469 test_struct_calls 12
470 test_struct_calls 13
471 test_struct_calls 14
472 test_struct_calls 15
473 test_struct_calls 16
474 test_struct_calls 17
475 test_struct_returns 1
476 test_struct_returns 2
477 test_struct_returns 3
478 test_struct_returns 4
479 test_struct_returns 5
480 test_struct_returns 6
481 test_struct_returns 7
482 test_struct_returns 8
483
484
485 # Let the fun begin.
486
487 # Assuming that any integer struct larger than 8 bytes goes in memory,
488 # come up with many and varied combinations of a return struct. For
489 # "struct calls" test just beyond that 8 byte boundary, for "struct
490 # returns" test up to that boundary.
491
492 # For floats, assumed that up to two struct elements can be stored in
493 # floating point registers, regardless of their size.
494
495 # The approx size of each structure it is computed assumed that tc=1,
496 # ts=2, ti=4, tl=4, tll=8, tf=4, td=8, tld=16, and that all fields are
497 # naturally aligned. Padding being added where needed. Note that
498 # these numbers are just approx, the d10v has ti=2, a 64-bit has has
499 # tl=8.
500
501 # Approx size: 2, 4, ...
502 start_structs_test { ts }
503 test_struct_calls 1
504 test_struct_calls 2
505 test_struct_calls 3
506 test_struct_calls 4
507 test_struct_calls 5
508 test_struct_returns 1
509 test_struct_returns 2
510 test_struct_returns 3
511 test_struct_returns 4
512
513 # Approx size: 4, 8, ...
514 start_structs_test { ti }
515 test_struct_calls 1
516 test_struct_calls 2
517 test_struct_calls 3
518 test_struct_returns 1
519 test_struct_returns 2
520
521 # Approx size: 4, 8, ...
522 start_structs_test { tl }
523 test_struct_calls 1
524 test_struct_calls 2
525 test_struct_calls 3
526 test_struct_returns 1
527 test_struct_returns 2
528
529 # Approx size: 8, 16, ...
530 start_structs_test { tll }
531 test_struct_calls 1
532 test_struct_calls 2
533 test_struct_returns 1
534
535 # Approx size: 4, 8, ...
536 start_structs_test { tf }
537 test_struct_calls 1
538 test_struct_calls 2
539 test_struct_calls 3
540 test_struct_returns 1
541 test_struct_returns 2
542
543 # Approx size: 8, 16, ...
544 start_structs_test { td }
545 test_struct_calls 1
546 test_struct_calls 2
547 test_struct_returns 1
548
549 # Approx size: 16, 32, ...
550 start_structs_test { tld }
551 test_struct_calls 1
552 test_struct_calls 2
553 test_struct_returns 1
554
555 # Approx size: 2+1=3, 4, ...
556 start_structs_test { ts tc }
557 test_struct_calls 2
558 test_struct_calls 3
559 test_struct_calls 4
560 test_struct_calls 5
561 test_struct_calls 6
562 test_struct_calls 7
563 test_struct_calls 8
564 test_struct_returns 2
565
566 # Approx size: 4+1=5, 6, ...
567 start_structs_test { ti tc }
568 test_struct_calls 2
569 test_struct_calls 3
570 test_struct_calls 4
571 test_struct_calls 5
572 test_struct_calls 6
573 test_struct_returns 2
574
575 # Approx size: 4+1=5, 6, ...
576 start_structs_test { tl tc }
577 test_struct_calls 2
578 test_struct_calls 3
579 test_struct_calls 4
580 test_struct_calls 5
581 test_struct_calls 6
582 test_struct_returns 2
583
584 # Approx size: 8+1=9, 10, ...
585 start_structs_test { tll tc }
586 test_struct_calls 2
587
588 # Approx size: 4+1=5, 6, ...
589 start_structs_test { tf tc }
590 test_struct_calls 2
591 test_struct_calls 3
592 test_struct_calls 4
593 test_struct_calls 5
594 test_struct_calls 6
595 test_struct_returns 2
596
597 # Approx size: 8+1=9, 10, ...
598 start_structs_test { td tc }
599 test_struct_calls 2
600
601 # Approx size: 16+1=17, 18, ...
602 start_structs_test { tld tc }
603 test_struct_calls 2
604
605 # Approx size: (1+1)+2=4, 6, ...
606 start_structs_test { tc ts }
607 test_struct_calls 2
608 test_struct_calls 3
609 test_struct_calls 4
610 test_struct_calls 5
611 test_struct_calls 6
612 test_struct_returns 2
613
614 # Approx size: (1+3)+4=8, 12, ...
615 start_structs_test { tc ti }
616 test_struct_calls 2
617 test_struct_calls 3
618 test_struct_calls 4
619 test_struct_returns 2
620
621 # Approx size: (1+3)+4=8, 12, ...
622 start_structs_test { tc tl }
623 test_struct_calls 2
624 test_struct_calls 3
625 test_struct_calls 4
626 test_struct_returns 2
627
628 # Approx size: (1+7)+8=16, 24, ...
629 start_structs_test { tc tll }
630 test_struct_calls 2
631
632 # Approx size: (1+3)+4=8, 12, ...
633 start_structs_test { tc tf }
634 test_struct_calls 2
635 test_struct_calls 3
636 test_struct_calls 4
637
638 # Approx size: (1+7)+8=16, 24, ...
639 start_structs_test { tc td }
640 test_struct_calls 2
641
642 # Approx size: (1+15)+16=32, 48, ...
643 start_structs_test { tc tld }
644 test_struct_calls 2
645
646 # Some float combinations
647
648 # Approx size: 8+4=12, 16, ...
649 # d10v: 4+4=8, 12, ...
650 start_structs_test { td tf }
651 test_struct_calls 2
652 test_struct_returns 2
653
654 # Approx size: (4+4)+8=16, 32, ...
655 # d10v: 4+4=8, 12, ...
656 start_structs_test { tf td }
657 test_struct_calls 2
658 test_struct_returns 2
659
660 return 0