Go to file
Nils-Christian Kempke b8dd7ddff9 testsuite, fortran: fix info-types for intel compilers
This info-types.exp test case had a few issues that this patch fixes.

First, the emitted symbol character(kind=1)/character*1 (different
compilers use different naming converntions here) which is checkedin the
test is not actually expected given the test program.  There is no
variable of that type in the test.  Still, gfortran emits it for every
Fortran program there is.  The reason is the way gfortran handles Fortran's
named main program.  It generates a wrapper around the Fortran program
that is quite similar to a C main function.  This C-like wrapper has
argc and argv arguments for command line argument passing and the argv
pointer type has a base type character(kind=1) DIE emitted at CU scope.

Given the program

  program prog
  end program prog

the degbug info gfortran emits looks somewhat like

   <0><c>: Abbrev Number: 3 (DW_TAG_compile_unit)
      ...
   <1><2f>: Abbrev Number: 4 (DW_TAG_subprogram)
      <30>   DW_AT_external    : 1
      <30>   DW_AT_name        : (indirect string, ...): main
      ...
   <2><51>: Abbrev Number: 1 (DW_TAG_formal_parameter)
      <52>   DW_AT_name        : (indirect string, ...): argc
      ...
   <2><5d>: Abbrev Number: 1 (DW_TAG_formal_parameter)
      <5e>   DW_AT_name        : (indirect string, ...): argv
      ...
      <62>   DW_AT_type        : <0x77>
      ...
   <2><6a>: Abbrev Number: 0
   ...
   <1><77>: Abbrev Number: 6 (DW_TAG_pointer_type)
      <78>   DW_AT_byte_size   : 8
      <79>   DW_AT_type        : <0x7d>
   <1><7d>: Abbrev Number: 2 (DW_TAG_base_type)
      <7e>   DW_AT_byte_size   : 1
      <7f>   DW_AT_encoding    : 8        (unsigned char)
      <80>   DW_AT_name        : (indirect string, ...): character(kind=1)
   <1><84>: Abbrev Number: 7 (DW_TAG_subprogram)
      <85>   DW_AT_name        : (indirect string, ...): prog
   ...

Ifx and flang do not emit any debug info for a wrapper main method so
the type is missing here.  There was the possibility of actually adding
a character*1 type variable to the Fortran executable, but both, ifx and
gfortran chose to emit this variable's type as a DW_TAG_string_type of
length one (instead of a character(kind=1), or whatever the respective
compiler naming convention is).  While string types are printed as
character*LENGHT in the fortran language part (e.g. when issuing a
'ptype') they do not generate any symbols inside GDB.  In read.c it says

   /* These dies have a type, but processing them does not create
      a symbol or recurse to process the children.  Therefore we can
      read them on-demand through read_type_die.  */

So they did not add any output to 'info types'.  Only flang did emit a
character type here.
As adding a type would have a) not solved the problem for ifx and would
have b) somehow hidden the curious behavior of gfortran, instead, the
check for this character type was chagened to optional with the
check_optional_entry to allow for the symbols's absence and to allow
flang and ifx to pass this test as well.

Second, the line checked for s1 was hardcoded as 37 in the test.  Given
that the type is actually defined on line 41 (which is what is emitted by
ifx) it even seems wrong.  The line check for s1 was changed to actually
check for 41 and a gfortran bug has been filed here

   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105454

The test is now marked as xfail for gfortran.

Third, the whole test of checking for the 'Type s1' in info types seemed
questionable.  The type s1 is declared iside the scope of the Fortran
program info_types_test.  Its DIE however is emitted as a child of the
whole compilation unit making it visible outside of the program's scope.
The 'info types' command checks for types stored in the GLOBAL_BLOCK,
or STATIC_BLOCKm wgucm according to block.h

   The GLOBAL_BLOCK contains all the symbols defined in this compilation
   whose scope is the entire program linked together.
   The STATIC_BLOCK contains all the symbols whose scope is the
   entire compilation excluding other separate compilations.

so for gfortran, the type shows up in the output of 'info types'.  For
flang and ifx on the other hand this is not the case.  The two compilers
emit the type (correctly) as a child of the Fortran program, thus not
adding it to either, the GLOBAL_BLOCK nor the LOCAL_BLOCK.  A bug has
been opened for the gfortran scoping issue:

   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105454

While the most correct change might have been removing the check for s1,
the change made here was to only check for this type in case of gfortran
being used as the compiler, as this check also covers the declaration
line issue mentioned above.  A comment was added to maybe remove this
check once the scoping issue is resolved (and it starts to fail with
newer gfortran versions).  The one used to test these changes was 13.0.
2022-05-31 16:44:56 +02:00
bfd sparc64 segfault in finish_dynamic_symbol 2022-05-31 21:14:00 +09:30
binutils Trailing spaces in objdump -r header 2022-05-31 11:25:09 +09:30
config Merge config/ changes from GCC, to enable DFP on AArch64 2022-05-24 10:47:29 +01:00
contrib
cpu
elfcpp
etc
gas ia64 gas: Remove unnecessary init 2022-05-31 21:14:00 +09:30
gdb testsuite, fortran: fix info-types for intel compilers 2022-05-31 16:44:56 +02:00
gdbserver Use aarch64_features to describe register features in target descriptions. 2022-05-18 13:32:04 -07:00
gdbsupport Finalize each cooked index separately 2022-05-26 07:35:30 -06:00
gnulib
gold Fix compile time warning building gold with Clang-14. 2022-05-18 16:29:57 +01:00
gprof Remove use of bfd_uint64_t and similar 2022-05-27 22:08:59 +09:30
gprofng gprofng: fix build with -mx32 2022-05-27 19:56:25 -07:00
include Import libiberty from gcc 2022-05-31 21:14:00 +09:30
intl
ld Ajdust more tests for opcodes/i386: remove trailing whitespace 2022-05-31 11:25:09 +09:30
libbacktrace
libctf
libdecnumber Merge config/ changes from GCC, to enable DFP on AArch64 2022-05-24 10:47:29 +01:00
libiberty Import libiberty from gcc 2022-05-31 21:14:00 +09:30
opcodes RISC-V: Add zhinx extension supports. 2022-05-30 11:42:08 +08:00
readline
sim sim: remove use of PTR 2022-05-13 14:32:54 +09:30
texinfo
zlib
.cvsignore
.editorconfig
.gitattributes
.gitignore
ar-lib
ChangeLog
compile
config-ml.in
config.guess
config.rpath
config.sub
configure
configure.ac
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.LIBGLOSS
COPYING.NEWLIB
depcomp
djunpack.bat
install-sh
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS
Makefile.def
Makefile.in
Makefile.tpl
makefile.vms
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
README-maintainer-mode
setup.com
src-release.sh
symlink-tree
test-driver
ylwrap

		   README for GNU development tools

This directory contains various GNU compilers, assemblers, linkers, 
debuggers, etc., plus their support routines, definitions, and documentation.

If you are receiving this as part of a GDB release, see the file gdb/README.
If with a binutils release, see binutils/README;  if with a libg++ release,
see libg++/README, etc.  That'll give you info about this
package -- supported targets, how to use it, how to report bugs, etc.

It is now possible to automatically configure and build a variety of
tools with one command.  To build all of the tools contained herein,
run the ``configure'' script here, e.g.:

	./configure 
	make

To install them (by default in /usr/local/bin, /usr/local/lib, etc),
then do:
	make install

(If the configure script can't determine your type of computer, give it
the name as an argument, for instance ``./configure sun4''.  You can
use the script ``config.sub'' to test whether a name is recognized; if
it is, config.sub translates it to a triplet specifying CPU, vendor,
and OS.)

If you have more than one compiler on your system, it is often best to
explicitly set CC in the environment before running configure, and to
also set CC when running make.  For example (assuming sh/bash/ksh):

	CC=gcc ./configure
	make

A similar example using csh:

	setenv CC gcc
	./configure
	make

Much of the code and documentation enclosed is copyright by
the Free Software Foundation, Inc.  See the file COPYING or
COPYING.LIB in the various directories, for a description of the
GNU General Public License terms under which you can copy the files.

REPORTING BUGS: Again, see gdb/README, binutils/README, etc., for info
on where and how to report problems.