Hi Sandra, hi all,

On 28.07.21 06:36, Sandra Loosemore wrote:
On 7/26/21 2:13 PM, Sandra Loosemore wrote:
On 7/26/21 3:45 AM, Tobias Burnus wrote:
PS: Still, it would be nice if the proper multi-lib ISO*.h could be
found;

(Example for x86-64-gnu-linux with 32bit and 64bit support)

Namely,
  x86_64-pc-linux-gnu/libgfortran/ISO_Fortran_binding.h
  x86_64-pc-linux-gnu/32/libgfortran/ISO_Fortran_binding.h
exist and they are different.

GCC finds the correct header, when running:
  make check-fortran RUNTESTFLAGS="--target_board=unix\{-m32\}"
which runs gfortran with:
  -B.../x86_64-pc-linux-gnu/32/libgfortran/

Likewise, with "-m32" replaced by "-m64" or "",
it works and gfortran is run with
  -B.../x86_64-pc-linux-gnu/./libgfortran/


But when running both at the same time, i.e.
  make check-fortran RUNTESTFLAGS="--target_board=unix\{,-m32\}"
(note the ',' before '-m32'), gfortran is run for
both "" (= -m64) and "-m32" with:
  -B.../x86_64-pc-linux-gnu/./libgfortran/
That's fine for -m64 but for -m32 it finds the wrong
ISO_Fortran_binding.h  file.


Solution:
Add a "-I" with the proper path to find the right *.h file.
'strace' confirms that the -I include path is searched before the
path provided by "-B".

[Note: I only did in-tree testing with that patch so far.]

Comments to the attached patch? Does it look OK?


 * * *

Unfortunately, I could not get this to work.

I think the attached version does work :-)

For installed-tree testing, this resulted in diagnostics about a
nonexistent directory on the include path.  In my i686-pc-linux-gnu
build I was having other problems when I tried build-tree testing using

make check-gfortran RUNTESTFLAGS="--target-board=localhost/m64"

I have an x86-64-gnu-linux build and there I use
"--target_board=unix\{,-m32\}",
which seems to work fine and runs it first with "" (= -m64) and then
with -m32.
(See above.)

I also do not see any issues with xfailing.

BTW, I can't find any documentation for what get_multilibs is supposed
to do.  It seems to be part of Dejagnu itself rather than the gcc test
support?

Yes, but the documentation is, well, short:
https://www.gnu.org/software/dejagnu/manual/get_005fmultilibs-procedure.html

In the DejaGNU source code, there is a better description (comment before the 
function):
Cf. 
https://git.savannah.gnu.org/gitweb/?p=dejagnu.git;a=blob;f=lib/libgloss.exp;;hb=HEAD#l389

Tobias

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 
München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas 
Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht 
München, HRB 106955
gfortran.dg/dg.exp: Add libgfortran as -I flag for ISO*.h [PR101305]

gcc/testsuite/
	PR libfortran/101305
	* gfortran.dg/dg.exp: Add '-I <get_multilibs>/libgfortran'
	compile flag.

diff --git a/gcc/testsuite/gfortran.dg/dg.exp b/gcc/testsuite/gfortran.dg/dg.exp
index 06689813d07..cb48ed3e7fb 100644
--- a/gcc/testsuite/gfortran.dg/dg.exp
+++ b/gcc/testsuite/gfortran.dg/dg.exp
@@ -28,6 +28,17 @@ if ![info exists DEFAULT_FFLAGS] then {
 # Initialize `dg'.
 dg-init
 
+# Flags for finding libgfortran ISO*.h files.
+if [info exists TOOL_OPTIONS] {
+   set specpath [get_multilibs ${TOOL_OPTIONS}]
+} else {
+   set specpath [get_multilibs]
+}
+set include_options "-I$specpath/libgfortran"
+if [file exists $specpath/libgfortran ] {
+    set include_options "-I$specpath/libgfortran" 
+}
+
 global gfortran_test_path
 global gfortran_aux_module_flags
 set gfortran_test_path $srcdir/$subdir
@@ -55,10 +66,10 @@ proc dg-compile-aux-modules { args } {
 
 # Main loop.
 gfortran-dg-runtest [lsort \
-       [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] "" $DEFAULT_FFLAGS
+       [glob -nocomplain $srcdir/$subdir/*.\[fF\]{,90,95,03,08} ] ] "" "$include_options $DEFAULT_FFLAGS"
 
 gfortran-dg-runtest [lsort \
-       [glob -nocomplain $srcdir/$subdir/g77/*.\[fF\] ] ] "" $DEFAULT_FFLAGS
+       [glob -nocomplain $srcdir/$subdir/g77/*.\[fF\] ] ] "" "$include_options $DEFAULT_FFLAGS"
 
 
 # All done.

Reply via email to