The following code worked for version 4.3 and 4.4 as of 9-28: MODULE HDF5 USE H5GLOBAL END MODULE HDF5 MODULE H5GLOBAL IMPLICIT NONE INTEGER :: H5P_flags INTEGER :: H5P_DEFAULT_F EQUIVALENCE(H5P_flags, H5P_DEFAULT_F) END MODULE H5GLOBAL PROGRAM fortranlibtest USE HDF5 IMPLICIT NONE INTEGER :: ii ii = H5P_DEFAULT_F END PROGRAM fortranlibtest The current version of 4.4 and 4.3 (Nov. 11) fails to compile the code with the error: gfortran43 H5f90global.o HDF5.o fortranlib_test.o -o test fortranlib_test.o(.text+0x19): In function `MAIN__': : undefined reference to `__h5global_MOD_h5p_default_f' collect2: ld returned 1 exit status *** Error code 1 4.2 compiles the code without a problem. NOTE: (1) If I remove the line EQUIVALENCE(H5P_flags, H5P_DEFAULT_F) it compiles fine. (2) If I move the contents of H5GLOBAL into the HDF5 module i.e. MODULE HDF5 IMPLICIT NONE INTEGER :: H5P_flags INTEGER :: H5P_DEFAULT_F EQUIVALENCE(H5P_flags, H5P_DEFAULT_F) END MODULE HDF5 it compiles fine.
This is a regression that appears to be caused by ------------------------------------------------------------------------ r140879 | pault | 2008-10-04 22:50:00 -0700 (Sat, 04 Oct 2008) | 12 lines 2008-10-04 Paul Thomas <pault@gcc.gnu.org> PR fortran/37706 * module.c (load_equiv): Check the module before negating the unused flag.
Ah, yes. The module name check only pertains to the module being read. Instead, it should check that the equivalence members are from the same module - this might itself be use associated into the module being read. Many thanks for the report. Paul
Subject: Bug 38171 Author: pault Date: Wed Nov 19 03:41:57 2008 New Revision: 141991 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141991 Log: 2008-11-19 Paul Thomas <pault@gcc.gnu.org> PR fortran/38171 * ChangeLog: Correct PR number. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/testsuite/ChangeLog
Subject: Bug 38171 Author: pault Date: Wed Nov 19 03:46:12 2008 New Revision: 141992 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141992 Log: 2008-11-19 Paul Thomas <pault@gcc.gnu.org> PR fortran/38171 * module.c (load_equiv): Regression fix; check that equivalence members come from the same module only. 2008-11-19 Paul Thomas <pault@gcc.gnu.org> PR fortran/38171 * gfortran.dg/module_equivalence_6.f90: New test. Added: branches/gcc-4_3-branch/gcc/testsuite/gfortran.dg/module_equivalence_6.f90 Modified: branches/gcc-4_3-branch/gcc/fortran/ChangeLog branches/gcc-4_3-branch/gcc/fortran/module.c branches/gcc-4_3-branch/gcc/testsuite/ChangeLog
Fixed on trunk and 4.3. Thanks for the report. Paul
I don't know if the code in comment #0 is valid or not, but if the file h5global.mod does not exist compiling it with gfortran r141995 gives: pr38171.f90:2.14: USE H5GLOBAL 1 Fatal Error: Can't open module file 'h5global.mod' for reading at (1): No such file or directory This error disappears if the module order is changed.
(In reply to comment #6) > I don't know if the code in comment #0 is valid or not, but if the file > h5global.mod does not exist compiling it with gfortran r141995 gives: > > pr38171.f90:2.14: > > USE H5GLOBAL > 1 > Fatal Error: Can't open module file 'h5global.mod' for reading at (1): No such > file or directory > Yes, the reporter had obviously already compiled the code so that the module was present:-) It is correct when it's the right way round and it's pukka fortran. Paul > This error disappears if the module order is changed. >