Make gdb.ada/float-bits.exp more generic
authorLuis Machado <luis.machado@arm.com>
Tue, 26 Apr 2022 10:56:07 +0000 (11:56 +0100)
committerLuis Machado <luis.machado@arm.com>
Thu, 12 May 2022 10:27:18 +0000 (11:27 +0100)
commitd1fb8316b09ea35edaaa9a93e32a3adba51aef46
treeb4bab89074258ab91179aa49c1da39450a471e36
parent59eb8e236c0a80258951d5fac57903db7a1cc7e0
Make gdb.ada/float-bits.exp more generic

There are assumptions in the test about the long double format
being used. While the results are OK for i387 128-bit long doubles, it
is not correct for IEEE quad 128-bit long doubles.

Also, depending on the target (64-bit/32-bit), long doubles may not
be available at all. And it may be the case that the compiler for a 64-bit
target doesn't support 128-bit long doubles, but GDB might still support it
internally.

Lastly, not every long double format has invalid values. Some formats
consider all values as valid floating point numbers.

These divergences cause the following FAIL's on aarch64/arm:

FAIL: gdb.ada/float-bits.exp: print val_long_double
FAIL: gdb.ada/float-bits.exp: print val_long_double after assignment

With the above in mind, extend the test a little so it behaves well on
different architectures and so it works with different long double
formats.

Main changes:

- Use long double values appropriate for the long double format.
- Test long double assignment to compiler-generated long
  double variables.
- Test long double assignment to GDB internal variables.

Tested on x86_64 (16 PASS), i686 (16 PASS), aarch64 (12 PASS) and arm (9 PASS).
gdb/testsuite/gdb.ada/float-bits.exp