[gdb/testsuite] Compile infcall-nested-structs.exp with -O2
As mentioned in commit
745ff14e6e1 "[gdb/tdep] Fix 'Unexpected register class'
assert in amd64_push_arguments", of the 12 KFAILs added there, 3 are KPASSing
with g++ 4.8.5.
The KPASSes are due to:
- gdb incorrectly expecting the second half of the result of function
rtn_str_struct_02_01 in register %rdx.
- rtn_str_struct_02_01 using %rdx as a temporary, thereby accidentally setting
it to the expected value.
Reduce the chance of hiding errors due accidental register settings by
compiling the test-case with -O2.
This fixes the KPASSes when applied on top of commit
745ff14e6e1.
Tested on x86_64-linux.
Tested with g++ 4.8.5, 7.4.1, 8.3.1, 9.2.1.
gdb/testsuite/ChangeLog:
2019-10-21 Tom de Vries <tdevries@suse.de>
* gdb.base/infcall-nested-structs.c: Add
__attribute__((noinline,noclone)) to all functions.
(call_all): Add missing variable initialization. Simplify return value.
(breakpt): Increment volatile variable, to prevent call from being
optimized out.
* gdb.base/infcall-nested-structs.exp: Compile with -O2.
Change-Id: Ic027e1c957fecd6686345639db99f5eaee3cdf05