Message ID | 20210713212859.1532449-4-sandra@codesourcery.com |
---|---|
State | New |
Headers | show |
Series | Bind(C): Fix kind/size mappings | expand |
On 13.07.21 23:28, Sandra Loosemore wrote: > ISO_Fortran_binding.h is now generated in the libgfortran build > directory where it is on the default include path. Adjust includes in > the gfortran testsuite not to include an explicit path pointing at the > source directory. ... > -#include "../../../libgfortran/ISO_Fortran_binding.h" > +#include "ISO_Fortran_binding.h" Unfortunately, that does not help. When running the testsuite in the build directory (cd $BUILD/gcc), I get: testsuite/gfortran.dg/pr93524.c:5:10: fatal error: ISO_Fortran_binding.h: No such file or directory I wonder whether we need to do the same as with libgomp and libstdc++, namely adding a libgfortran/testsuite/ to handle this. In any case, compiling with '-v' shows all currently searched include paths are the same for -m32 and -m64, which is will pick up the wrong one for -m32. I tried it by using the command line used when running in tree make check-fortran RUNTESTFLAGS="dg.exp=pr93524.f90 --target_board=unix\{-m32,\}" 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
Hi Sandra, On 21.07.21 12:17, Tobias Burnus wrote: > On 13.07.21 23:28, Sandra Loosemore wrote: >> ISO_Fortran_binding.h is now generated in the libgfortran build >> directory where it is on the default include path. Adjust includes in >> the gfortran testsuite not to include an explicit path pointing at the >> source directory. > ... >> -#include "../../../libgfortran/ISO_Fortran_binding.h" >> +#include "ISO_Fortran_binding.h" > Unfortunately, that does not help. It seems as if the following works in the *.exp file: # Flags for finding libgfortran ISO*.h files. if [info exists TOOL_OPTIONS] { set specpath [get_multilibs ${TOOL_OPTIONS}] } else { set specpath [get_multilibs] } set options "-I $specpath/libgfortran/" I am not sure whether that should/can be added into gfortran.dg/dg.exp or whether we only want to do this in ts29113/ts29113.exp alias c-interop/interop.exp f18-c-interop/interop.exp ... That seems to work fine with -m32 and -m64. 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
On 7/23/21 8:15 AM, Tobias Burnus wrote: > Hi Sandra, > > On 21.07.21 12:17, Tobias Burnus wrote: >> On 13.07.21 23:28, Sandra Loosemore wrote: >>> ISO_Fortran_binding.h is now generated in the libgfortran build >>> directory where it is on the default include path. Adjust includes in >>> the gfortran testsuite not to include an explicit path pointing at the >>> source directory. >> ... >>> -#include "../../../libgfortran/ISO_Fortran_binding.h" >>> +#include "ISO_Fortran_binding.h" >> Unfortunately, that does not help. > > It seems as if the following works in the *.exp file: > > # Flags for finding libgfortran ISO*.h files. > if [info exists TOOL_OPTIONS] { > set specpath [get_multilibs ${TOOL_OPTIONS}] > } else { > set specpath [get_multilibs] > } > set options "-I $specpath/libgfortran/" > > I am not sure whether that should/can be added into > gfortran.dg/dg.exp > or whether we only want to do this in > ts29113/ts29113.exp > alias > c-interop/interop.exp > f18-c-interop/interop.exp > ... > > That seems to work fine with -m32 and -m64. Well, given that the original patch in this thread was for tests outside the ts29113 testsuite, any fix has to go someplace where those tests would pick it up too. I'm not seeing the include path failures Tobias is seeing, so I can't confirm his change fixes them, either. When I do "make check-fortran" in my build tree, it seems to be finding the include files because of there being a pile of -B options added to the gfortran command line. I don't know where those are coming from, or why this isn't working for Tobias. :-S -Sandra
Hi Sandra, On 23.07.21 22:43, Sandra Loosemore wrote: > On 7/23/21 8:15 AM, Tobias Burnus wrote: >> On 21.07.21 12:17, Tobias Burnus wrote: >>> On 13.07.21 23:28, Sandra Loosemore wrote: >>>> ISO_Fortran_binding.h is now generated in the libgfortran build >>>> directory where it is on the default include path. Adjust includes >>>> [...] >>> Unfortunately, that does not help. >> It seems as if the following works in the *.exp file: >> [...] > I'm not seeing the include path failures Tobias is seeing, [...] why > this isn't working for Tobias. :-S I also do not have any idea – I did bootstrap before into an empty directory and I don't think I had other patches applied. I have no idea why it did not work – nor why it now works. I did now (again?): * Reset all patches + re-apply your three patches * Bootstrap into an empty directory with $ ..../configure --prefix=... --enable-multiarch --enable-languages=c,c++,fortran,lto,objc $ make -j12 && make install $ cd gcc $ make check-fortran RUNTESTFLAGS="dg.exp=ISO_Fortran_binding_1.f90 --target_board=unix\{,-m32\}" and now I got: === gfortran Summary for unix === # of expected passes 12 === gfortran Summary for unix/-m32 === # of expected passes 12 Thus, it (mostly) works. (I also did a more complete 'make check-fortran' run.) * * * I did say that it mostly works because of: $ find x86_64-pc-linux-gnu/ -name ISO_Fortran_binding.h x86_64-pc-linux-gnu/libgfortran/ISO_Fortran_binding.h x86_64-pc-linux-gnu/32/libgfortran/ISO_Fortran_binding.h And when looking at the -B lines, I see for the '' alias '-m64' run: -B.../build/gcc/testsuite/gfortran/../../ -B.../build/x86_64-pc-linux-gnu/./libgfortran/ -B.../build/x86_64-pc-linux-gnu/./libgfortran/.libs -B.../build/x86_64-pc-linux-gnu/./libquadmath/.libs which is fine (second line ensures the ISO*.h file is found.) But for -m32, I see: -B.../build/gcc/testsuite/gfortran/../../ -B.../build/x86_64-pc-linux-gnu/./libgfortran/ -B.../build/x86_64-pc-linux-gnu/32/libgfortran/.libs -B.../build/x86_64-pc-linux-gnu/32/libquadmath/.libs That also works, but it uses again the same directory for ISO*.h, such that the -m64 header file is used instead of the -m32 one. * * * I am not sure whether it really matters – the differences between the header files is (on x86-64-gnu-linux): -#define CFI_type_int128_t (CFI_type_Integer + (16 << CFI_type_kind_shift)) -#define CFI_type_int_least128_t (CFI_type_Integer + (16 << CFI_type_kind_shift)) -#define CFI_type_int_fast128_t (CFI_type_Integer + (16 << CFI_type_kind_shift)) +#define CFI_type_int128_t -2 +#define CFI_type_int_least128_t -2 +#define CFI_type_int_fast128_t -2 There might be larger differences on other multi-arch systems, but at least for x86-64, it seems to be harmless. (-2 = not available). For instance, there might be an issue on Windows. (I keep forgetting what sizeof(long) is with -m64 – is is the same as sizeof(int) as with -m32? Or is it 64bit with -m64?) * * * Thus, I am puzzled why it failed before and not longer. But given that it works now: LGTM, thanks for the patch and sorry for the confusion! Tobias PS: Still, it would be nice if the proper multi-lib ISO*.h could be found; while it usually does not matter, it could do so in some cases. ----------------- 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
On 7/26/21 3:45 AM, Tobias Burnus wrote: > > [snip] > > I did say that it mostly works because of: > > $ find x86_64-pc-linux-gnu/ -name ISO_Fortran_binding.h > x86_64-pc-linux-gnu/libgfortran/ISO_Fortran_binding.h > x86_64-pc-linux-gnu/32/libgfortran/ISO_Fortran_binding.h > > And when looking at the -B lines, I see for the '' alias '-m64' run: > -B.../build/gcc/testsuite/gfortran/../../ > -B.../build/x86_64-pc-linux-gnu/./libgfortran/ > -B.../build/x86_64-pc-linux-gnu/./libgfortran/.libs > -B.../build/x86_64-pc-linux-gnu/./libquadmath/.libs > > which is fine (second line ensures the ISO*.h file is found.) > > But for -m32, I see: > > -B.../build/gcc/testsuite/gfortran/../../ > -B.../build/x86_64-pc-linux-gnu/./libgfortran/ > -B.../build/x86_64-pc-linux-gnu/32/libgfortran/.libs > -B.../build/x86_64-pc-linux-gnu/32/libquadmath/.libs > > That also works, but it uses again the same directory for ISO*.h, > such that the -m64 header file is used instead of the -m32 one. I did some more experiments and I see that too. :-S It's finding a .h file, but not the right one. :-( > PS: Still, it would be nice if the proper multi-lib ISO*.h could be found; > while it usually does not matter, it could do so in some cases. I think I ought to fix this now instead of just sweeping it under the rug. The suggestion you made previously to add > # Flags for finding libgfortran ISO*.h files. > if [info exists TOOL_OPTIONS] { > set specpath [get_multilibs ${TOOL_OPTIONS}] > } else { > set specpath [get_multilibs] > } > set options "-I $specpath/libgfortran/" to the .exp files looks consistent with what I see elsewhere for adding things to the include path, so I will give it a try and see how it works. -Sandra
On 7/26/21 2:13 PM, Sandra Loosemore wrote: > On 7/26/21 3:45 AM, Tobias Burnus wrote: >> >> [snip] >> >> PS: Still, it would be nice if the proper multi-lib ISO*.h could be >> found; >> while it usually does not matter, it could do so in some cases. > > I think I ought to fix this now instead of just sweeping it under the > rug. The suggestion you made previously to add > >> # Flags for finding libgfortran ISO*.h files. >> if [info exists TOOL_OPTIONS] { >> set specpath [get_multilibs ${TOOL_OPTIONS}] >> } else { >> set specpath [get_multilibs] >> } >> set options "-I $specpath/libgfortran/" > > to the .exp files looks consistent with what I see elsewhere for adding > things to the include path, so I will give it a try and see how it works. Unfortunately, I could not get this to 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" or similar variants of --target-board (it seemed to be ignoring all the xfails?) so I did not think that could be the way people who normally test in the build tree can be doing it. And when I tried a recipe like make check-gfortran RUNTESTFLAGS="ts29113.exp --tool_opts='-m64'" it found the ISO_Fortran_binding.h via the correct /64-specific path via a -B option, same as for installed-tree testing. Since the patch was already approved without additional hacks to include file paths, I went ahead and pushed it as-is. If somebody can provide me with an exact recipe for reproducing failures to find the include file, I'll take another stab at it, but TBH this is far from my area of expertise. :-( 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? -Sandra
On Jul 13 2021, Sandra Loosemore wrote: > diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c > index a571459..9da5d85 100644 > --- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c > +++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c > @@ -1,6 +1,6 @@ > /* Test F2008 18.5: ISO_Fortran_binding.h functions. */ > > -#include "../../../libgfortran/ISO_Fortran_binding.h" > +#include "ISO_Fortran_binding.h" Shouldn't that use <ISO_Fortran_binding.h> since that is an installed header, not one that is supposed to be picked up from the current directory? Andreas.
Hi Andreas, On 04.08.21 11:00, Andreas Schwab wrote: > On Jul 13 2021, Sandra Loosemore wrote: >> -#include "../../../libgfortran/ISO_Fortran_binding.h" >> +#include "ISO_Fortran_binding.h" > Shouldn't that use <ISO_Fortran_binding.h> since that is an installed > header, not one that is supposed to be picked up from the current > directory? Yes – thus, it was changed by my patch: https://gcc.gnu.org/pipermail/gcc-patches/2021-August/576970.html https://gcc.gnu.org/r12-2808-g527a1cf32c27a3fbeaf6be7596241570d864cc4c <https://gcc.gnu.org/r12-2808-g527a1cf32c27a3fbeaf6be7596241570d864cc4c> Thanks for keeping an eye on patches and reporting issues :-) 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
diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c index a571459..9da5d85 100644 --- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c +++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_1.c @@ -1,6 +1,6 @@ /* Test F2008 18.5: ISO_Fortran_binding.h functions. */ -#include "../../../libgfortran/ISO_Fortran_binding.h" +#include "ISO_Fortran_binding.h" #include <assert.h> #include <stdio.h> #include <stdlib.h> diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_10.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_10.c index 9f06e2d..c3954e4 100644 --- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_10.c +++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_10.c @@ -2,7 +2,7 @@ /* Contributed by Reinhold Bader <Bader@lrz.de> */ -#include "../../../libgfortran/ISO_Fortran_binding.h" +#include "ISO_Fortran_binding.h" #include <stdlib.h> #include <stdio.h> #include <stdbool.h> diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_11.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_11.c index ac17690..c2d4e11 100644 --- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_11.c +++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_11.c @@ -5,7 +5,7 @@ Contributed by Reinhold Bader <Bader@lrz.de>#include <stdio.h> */ #include <stdlib.h> #include <stddef.h> #include <stdio.h> -#include "../../../libgfortran/ISO_Fortran_binding.h" +#include "ISO_Fortran_binding.h" typedef struct { diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_12.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_12.c index 279d9f6..078c5de 100644 --- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_12.c +++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_12.c @@ -2,7 +2,7 @@ #include <stdio.h> #include <math.h> -#include "../../../libgfortran/ISO_Fortran_binding.h" +#include "ISO_Fortran_binding.h" /* Contributed by Reinhold Bader <Bader@lrz.de> */ diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_15.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_15.c index f5c83c7..622f2de 100644 --- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_15.c +++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_15.c @@ -4,7 +4,7 @@ #include <stdlib.h> #include <stdio.h> -#include "../../../libgfortran/ISO_Fortran_binding.h" +#include "ISO_Fortran_binding.h" // Prototype for Fortran functions extern void Fsub(CFI_cdesc_t *); diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_16.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_16.c index cdee0b8..50b92ec 100644 --- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_16.c +++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_16.c @@ -1,6 +1,6 @@ /* Test the fix for PR92142. */ -#include "../../../libgfortran/ISO_Fortran_binding.h" +#include "ISO_Fortran_binding.h" #include <stdlib.h> diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.c index 14dfcc9..b0893cc 100644 --- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.c +++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_17.c @@ -2,7 +2,7 @@ #include <stdio.h> #include <assert.h> -#include "../../../libgfortran/ISO_Fortran_binding.h" +#include "ISO_Fortran_binding.h" void Csub(const CFI_cdesc_t *, size_t, CFI_index_t invalid); diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_18.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_18.c index eef5cc6..ef40134 100644 --- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_18.c +++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_18.c @@ -1,6 +1,6 @@ #include <stdlib.h> #include <string.h> -#include "../../../libgfortran/ISO_Fortran_binding.h" +#include "ISO_Fortran_binding.h" extern int do_loop(CFI_cdesc_t* array); diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_3.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_3.c index a9f64cd..9f35b0d 100644 --- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_3.c +++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_3.c @@ -1,4 +1,4 @@ -#include "../../../libgfortran/ISO_Fortran_binding.h" +#include "ISO_Fortran_binding.h" #include <stdio.h> #include <stdlib.h> diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_5.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_5.c index f8bdb27..116f548 100644 --- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_5.c +++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_5.c @@ -4,7 +4,7 @@ #include <stdio.h> #include <math.h> -#include "../../../libgfortran/ISO_Fortran_binding.h" +#include "ISO_Fortran_binding.h" typedef struct { int i; diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_6.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_6.c index 9ef46ce..704b27c 100644 --- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_6.c +++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_6.c @@ -4,7 +4,7 @@ #include <stdio.h> #include <math.h> -#include "../../../libgfortran/ISO_Fortran_binding.h" +#include "ISO_Fortran_binding.h" #define DEBUG 0 diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_7.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_7.c index d68428f..26b4ab5 100644 --- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_7.c +++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_7.c @@ -2,7 +2,7 @@ /* Contributed by Reinhold Bader <Bader@lrz.de> */ -#include "../../../libgfortran/ISO_Fortran_binding.h" +#include "ISO_Fortran_binding.h" #include <stdio.h> #include <stdlib.h> #include <math.h> diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_8.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_8.c index dc80cd3..a0d1bdc 100644 --- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_8.c +++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_8.c @@ -2,7 +2,7 @@ /* Contributed by Reinhold Bader <Bader@lrz.de> */ -#include "../../../libgfortran/ISO_Fortran_binding.h" +#include "ISO_Fortran_binding.h" #include <stdio.h> float Cxgl[] = { 1.1, 2.3, 5.1, 4.2 }; diff --git a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_9.c b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_9.c index cb5b91d..632604f 100644 --- a/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_9.c +++ b/gcc/testsuite/gfortran.dg/ISO_Fortran_binding_9.c @@ -2,7 +2,7 @@ /* Contributed by Gilles Gouaillardet <gilles@rist.or.jp> */ -#include "../../../libgfortran/ISO_Fortran_binding.h" +#include "ISO_Fortran_binding.h" #include <stdlib.h> int cdesc_c(CFI_cdesc_t* x, long *expected) diff --git a/gcc/testsuite/gfortran.dg/bind_c_array_params_3_aux.c b/gcc/testsuite/gfortran.dg/bind_c_array_params_3_aux.c index 07d1a03..5176d8b 100644 --- a/gcc/testsuite/gfortran.dg/bind_c_array_params_3_aux.c +++ b/gcc/testsuite/gfortran.dg/bind_c_array_params_3_aux.c @@ -5,7 +5,7 @@ #include <errno.h> #include <stdio.h> -#include "../../../libgfortran/ISO_Fortran_binding.h" +#include "ISO_Fortran_binding.h" void arr_set_c(CFI_cdesc_t*); diff --git a/gcc/testsuite/gfortran.dg/iso_fortran_binding_uint8_array_driver.c b/gcc/testsuite/gfortran.dg/iso_fortran_binding_uint8_array_driver.c index 79b8a14..bfd567b 100644 --- a/gcc/testsuite/gfortran.dg/iso_fortran_binding_uint8_array_driver.c +++ b/gcc/testsuite/gfortran.dg/iso_fortran_binding_uint8_array_driver.c @@ -1,7 +1,7 @@ #include <stdlib.h> #include <stdio.h> #include <inttypes.h> -#include "../../../libgfortran/ISO_Fortran_binding.h" +#include "ISO_Fortran_binding.h" extern void fsub(CFI_cdesc_t *); diff --git a/gcc/testsuite/gfortran.dg/pr93524.c b/gcc/testsuite/gfortran.dg/pr93524.c index 24e5e09..ba40d00 100644 --- a/gcc/testsuite/gfortran.dg/pr93524.c +++ b/gcc/testsuite/gfortran.dg/pr93524.c @@ -2,7 +2,7 @@ sm incorrectly for dimensions > 2. */ #include <stdlib.h> // For size_t -#include "../../../libgfortran/ISO_Fortran_binding.h" +#include "ISO_Fortran_binding.h" void my_fortran_sub_1 (CFI_cdesc_t *dv); void my_fortran_sub_2 (CFI_cdesc_t *dv);