binutils-gdb/gdb/testsuite/gdb.fortran
Nils-Christian Kempke 6dc7160b2d gdb/testsuite: fix testsuite regressions for unix/-m32 board
This commit fixes two regressions introduced by
891e4190ba.

Reason for the failures was, that on a 32 bit machine the maximum
array length as well as the maximum allocatable memory for arrays
(in bytes) both seem to be limited by the maximum value of a 4
byte (signed) Fortran integer.  This lead to compiler errors/unexpected
behavior when compiling/running the test with the -m32 board.  This
behavior is compiler dependent and can differ for different compiler
implementations, but generally, it seemed like a good idea to simply
avoid such situations.

The affected tests check for GDB's overflow behavior when using KIND
parameters with GDB implemented Fortran intrinsic functions.  If these
KIND parameters are too small to fit the actual intrinsic function's
result, an overflow is expected.  This was done for 1, 2, and 4
byte overflows.  The last one caused problems, as it tried to allocate
arrays of length/byte-size bigger than the 4 byte signed integers which
would then be used with the LBOUND/UBOUND/SIZE intrinsics.

The tests were adapted to only execute the 4 byte overflow tests when
running on targets with 64 bit.  For this, the compiled tests evaluate the
byte size of a C_NULL_PTR via C_SIZEOF, both defined in the ISO_C_BINDING
module.  The ISO_C_BINDING constant C_NULL_PTR is a Fortran 2003, the
C_SIZEOF a Fortran 2008 extension.  Both have been implemented in their
respective compilers for while (e.g. C_SIZEOF is available since
gfortran 4.6).  If this byte size evaluates to less than 8 we skip the
4 byte overflow tests in the compiled tests of size.f90 and
lbound-ubound.f90.  Similarly, in the lbound-ubound.exp testsfile we skip
the 4 byte overflow tests if the procedure is_64_target evaluates to false.

In size.f90, additionally, the to-be-allocated amount of bytes did not
fit into 4 byte signed integers for some of the arrays, as it was
approximately 4 times the maximum size of a 4 byte signed integer.  We
adapted the dimensions of the arrays in question as the meaningfulness
of the test does not suffer from this.

With this patch both test run fine with the unix/-m32 board and
gcc/gfortran (9.4) as well as the standard board file.

We also thought about completely removing the affected test from the
testsuite.  We decided against this as the 32 bit identification comes
with Fortran 2008 and removing tests would have decreased coverage.

A last change that happened with this patch was due to gfortran's and
ifx's type resolution when assigning big constants to Fortran Integer*8
variables.  Before the above changes this happened in a parameter
statement.  Here, both compilers happily accepted a line like

  integer*8, parameter :: var = 2147483647 + 5.

After this change the assignment is not done as a parameter
anymore, as this triggered compile time overflow errors.  Instead,
the assignment is done dynamically, depending on the kind of machine one
is on.  Sadly, just changing this line to

  integer*8 :: var
  var = 2147483647 + 5

does not work with ifx (or flang for that matter, they behave similarly
here).  It will create an integer overflow in the addition as ifx deduces
the type the additon is done in as Integer*4.  So var will actually
contain the value -2147483644 after this.  The lines

  integer*8 :: var
  var = 2147483652

on the other hand fail to compile with gfortran (9.4.0) as the compiler
identifies an Integer overflow here.  Finally, to make this work with
all three compilers an additional parameter has been introduced

  integer*8, parameter :: helper = 2147483647
  integer*8 :: var
  var = helper + 5.

This works on all 3 compilers as expected.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29053
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29054
2022-05-10 14:54:46 +02:00
..
allocated.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
allocated.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
array-bounds-high.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
array-bounds-high.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
array-bounds.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
array-bounds.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
array-element.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
array-element.f Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
array-indices.exp Respect `set print array-indexes' with Fortran arrays 2022-01-19 21:55:10 +00:00
array-no-bounds.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
array-no-bounds.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
array-repeat.exp Respect `set print repeats' with Fortran arrays 2022-01-19 21:55:10 +00:00
array-repeat.f90 Respect `set print repeats' with Fortran arrays 2022-01-19 21:55:10 +00:00
array-slices-bad.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
array-slices-bad.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
array-slices-repeat.f90 Respect `set print repeats' with Fortran arrays 2022-01-19 21:55:10 +00:00
array-slices-sub-slices.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
array-slices-sub-slices.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
array-slices.exp Make gdb.fortran/{array-slices,lbound-ubound} work against gdbserver 2022-03-16 12:12:09 +00:00
array-slices.f90 Make gdb.fortran/{array-slices,lbound-ubound} work against gdbserver 2022-03-16 12:12:09 +00:00
associated.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
associated.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
assumedrank.exp gdb/fortran: Support for assumed rank zero 2022-04-25 14:58:30 +05:30
assumedrank.f90 gdb/fortran: Support for assumed rank zero 2022-04-25 14:58:30 +05:30
block-data.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
block-data.f Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
call-no-debug-func.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
call-no-debug-prog.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
call-no-debug.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
charset.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
charset.f90
class-allocatable-array.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
class-allocatable-array.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
common-block.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
common-block.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
completion.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
completion.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
complex.exp gdb/fortran/testsuite: add complex from integers test 2022-04-11 14:06:56 +02:00
complex.f90 gdb/fortran/testsuite: add complex from integers test 2022-04-11 14:06:56 +02:00
debug-expr.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
debug-expr.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
derived-type-function.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
derived-type-function.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
derived-type-striding.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
derived-type-striding.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
derived-type.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
derived-type.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
dot-ops.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
dynamic-ptype-whatis.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
dynamic-ptype-whatis.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
exprs.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
function-calls.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
function-calls.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
info-modules.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
info-types-2.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
info-types.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
info-types.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
intrinsics.exp gdb/fortran: rewrite intrinsic handling and add some missing overloads 2022-04-11 14:06:56 +02:00
intrinsics.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
intvar-array.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
intvar-array.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
intvar-dynamic-types.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
intvar-dynamic-types.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
lbound-ubound.exp gdb/testsuite: fix testsuite regressions for unix/-m32 board 2022-05-10 14:54:46 +02:00
lbound-ubound.F90 gdb/testsuite: fix testsuite regressions for unix/-m32 board 2022-05-10 14:54:46 +02:00
library-module-lib.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
library-module-main.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
library-module.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
logical.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
logical.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
max-depth.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
max-depth.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
mixed-lang-stack.c Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
mixed-lang-stack.cpp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
mixed-lang-stack.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
mixed-lang-stack.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
module.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
module.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
multi-dim.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
multi-dim.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
namelist.exp gdb/fortran: support ptype and print commands for namelist variables 2022-02-11 15:26:25 +00:00
namelist.f90 gdb/fortran: support ptype and print commands for namelist variables 2022-02-11 15:26:25 +00:00
nested-funcs-2.exp gdb, testsuite, fortran: adapt info symbol expected output for intel compilers 2022-01-31 10:14:47 -07:00
nested-funcs-2.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
nested-funcs.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
nested-funcs.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
oop_extend_type.exp gdb/fortran: print fortran extended types with ptype 2022-04-08 12:17:13 +02:00
oop_extend_type.f90 gdb/fortran: add support for accessing fields of extended types 2022-04-08 12:17:13 +02:00
pointer-to-pointer.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
pointer-to-pointer.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
pointers.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
print-formatted.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
print-formatted.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
print_type.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
printing-types.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
printing-types.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
ptr-indentation.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
ptr-indentation.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
ptype-on-functions.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
ptype-on-functions.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
rank.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
rank.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
shape.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
shape.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
short-circuit-argument-list.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
short-circuit-argument-list.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
size.exp gdb/fortran: rewrite intrinsic handling and add some missing overloads 2022-04-11 14:06:56 +02:00
size.f90 gdb/testsuite: fix testsuite regressions for unix/-m32 board 2022-05-10 14:54:46 +02:00
subarray.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
subarray.f Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
type-kinds.exp gdb/f-lang: add Integer*1 to Fortran builtin types 2022-04-11 14:06:55 +02:00
type.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
types.exp gdb/fortran: Change GDB print for fortran default types 2022-04-11 14:06:56 +02:00
vla-alloc-assoc.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
vla-datatypes.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
vla-datatypes.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
vla-history.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
vla-ptr-info.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
vla-ptype-sub.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
vla-ptype.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
vla-sizeof.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
vla-sub.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
vla-type.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
vla-type.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
vla-value-sub-arbitrary.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
vla-value-sub-finish.exp Respect `set print repeats' with Fortran arrays 2022-01-19 21:55:10 +00:00
vla-value-sub.exp Respect `set print repeats' with Fortran arrays 2022-01-19 21:55:10 +00:00
vla-value.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
vla.f90 Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
whatis_type.exp Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00