gdb, testsuite, fortran: Fix sizeof intrinsic for Fortran pointers
For Fortran pointers gfortran/ifx emits DW_TAG_pointer_types like
<2><17d>: Abbrev Number: 22 (DW_TAG_variable)
<180> DW_AT_name : (indirect string, offset: 0x1f1): fptr
<184> DW_AT_type : <0x214>
...
<1><219>: Abbrev Number: 27 (DW_TAG_array_type)
<21a> DW_AT_type : <0x10e>
<216> DW_AT_associated : ...
The 'pointer property' in Fortran is implicitly modeled by adding a
DW_AT_associated to the type of the variable (see also the
DW_AT_associated description in DWARF 5). A Fortran pointer is more
than an address and thus different from a C pointer. It is a
self contained type having additional fields such as, e.g., the rank of
its underlying array. This motivates the intended DWARF modeling of
Fortran pointers via the DW_AT_associated attribute.
This patch adds support for the sizeof intrinsic by simply dereferencing
pointer types when encountered during a sizeof evaluation.
The patch also adds a test for the sizeof intrinsic which was not tested
before.
Tested-by: Thiago Jung Bauermann <thiago.bauermann@linaro.org>
Approved-By: Tom Tromey <tom@tromey.com>
3 files changed