Hi! Well... I've spoted a problem for a couple of weeks now, but I don't seem to be able to make a "nice" case from it... I'm sorry I do not know anything about compiler developpement, and I try to keep a safe distance from C... So, here are the original sources (minus a lot of thinks which were not necessary)... I hope it makes sense to someone... Philippe PS: I can also send the files as a tarball, I just don't know how to... -------------------------------------------------------------------------------- PPS: my version: GNU Fortran 95 (GCC 4.1.0 20050517 (experimental)) Copyright (C) 2005 Free Software Foundation, Inc. GNU Fortran comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of GNU Fortran under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING -------------------------------------------------------------------------------- PPPS: the error message I get: MODULE_IO.f90:0: internal compiler error: in lhd_set_decl_assembler_name, at langhooks.c:165 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. MODULE_SPRACHE.f90: In function ???ctn_error_interception???: MODULE_SPRACHE.f90:120: internal compiler error: in gfc_conv_variable, at fortran/trans-expr.c:350 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. -------------------------------------------------------------------------------- PPPPS: how to get it: rm -f *.o *.mod ./gfortran -g -pedantic-errors -Wall -c MODULE_IO.f90 ./gfortran -g -pedantic-errors -Wall -c MODULE_SPRACHE.f90 -------------------------------------------------------------------------------- PPPPPS: first file: "MODULE_IO.f90": !======================================================================! ! ********************************************************************** ! * * ! * M O D U L E _ I O * ! * * ! ********************************************************************** !======================================================================! ! ! Object: ! ====== ! Generic subroutines for input/output. ! ! !======================================================================! ! USER-defines and Parameters !======================================================================! ! ! MODULE MODULE_IO ! ! ! Modules ! ======= ! USE MODULE_DIMENSION, ONLY: Length_File_Name INTEGER, PARAMETER :: Length_File_Name = 250 ! ! ! ! Integer ! ======= INTEGER, PARAMETER :: Screen = 01 ! ! ! Character ! ========= CHARACTER ( LEN = Input_String_Length ):: bufferString ! ! ! Interface for outAusgabe ! ======================== ! INTERFACE SUBROUTINE outAusgabe ( Output, String, Boolean, Intg, & & Single, Double, Fmt ) ! USE MODULE_DIMENSION, ONLY: Sng, Dbl LOGICAL, OPTIONAL, INTENT ( IN ) :: Boolean INTEGER, INTENT ( IN ) :: Output INTEGER, OPTIONAL, INTENT ( IN ) :: Intg REAL ( KIND = 4 ), OPTIONAL, INTENT ( IN ) :: Single REAL ( KIND = 8 ), OPTIONAL, INTENT ( IN ) :: Double CHARACTER ( LEN = * ), OPTIONAL, INTENT(IN) :: String CHARACTER ( LEN = * ), OPTIONAL, INTENT(IN) :: Fmt END SUBROUTINE outAusgabe END INTERFACE ! ! ! Generic interface for Ausgabe ! ============================= ! INTERFACE Ausgabe ! MODULE PROCEDURE outString ! END INTERFACE Ausgabe ! ! ! Subroutines for generic interface for Eingabe ! ============================================= ! CONTAINS ! ! ! Subroutines for generic interface for Ausgabe ! ============================================= ! SUBROUTINE outString ( Unit, String, Fmt ) ! USE MODULE_DIMENSION, ONLY: Sng, Dbl IMPLICIT NONE INTEGER, INTENT ( IN ) :: Unit CHARACTER ( LEN = * ), INTENT ( IN ) :: String CHARACTER ( LEN = * ), OPTIONAL, INTENT ( IN ):: Fmt IF ( PRESENT ( Fmt ) ) THEN CALL outAusgabe ( Output = Unit, String = String, & & Fmt = Fmt ) ELSE CALL outAusgabe ( Output = Unit, String = String ) ENDIF END SUBROUTINE outString ! ! !======================================================================! ! End: Module MODULE_IO !======================================================================! ! END MODULE MODULE_IO ! -------------------------------------------------------------------------------- PPPPPS: first file: "MODULE_SPRACHE.f90": !======================================================================! ! ********************************************************************** ! * * ! * M O D U L E _ S P R A C H E * ! * * ! ********************************************************************** !======================================================================! ! Zweck: ! ====== ! Fortran90 Module for language settings ! ! Verwaltung: ! =========== ! Angelegt am 05.12.00 Philippe Schaffnit ! Last changes ! 09.02.01 PS Changes related to V2.2 ! 20.01.05 PS 'Message' functions here ! !======================================================================! ! Variables-documentation !======================================================================! ! ! Unit is the number of the unit affected to the messages file ! Path_* is the path to this file (without extension) starting from ! the directory specified by the user at the beginning of simulation. ! !======================================================================! ! Declarations !======================================================================! ! ! MODULE MODULE_SPRACHE ! ! ! Modules ! ======= ! USE MODULE_DIMENSION, ONLY: Length_File_Name, Length_Message USE MODULE_IO INTEGER, PARAMETER :: Length_Message = 250 ! ! ! Character ! ========= ! CHARACTER ( LEN = * ), PARAMETER :: New_message = & & "----------" ! ! !======================================================================! ! "Message functions" !======================================================================! ! CONTAINS ! ! !======================================================================! ! "Read_Message" !======================================================================! ! FUNCTION Read_Message ( Name, Unit, Message, Line ) ! USE MODULE_IO IMPLICIT NONE LOGICAL :: Unit_Connected INTEGER, INTENT ( IN ) :: Unit, Message, Line INTEGER :: IO_Stat, Number, k CHARACTER ( LEN =Length_Message):: Read_Message CHARACTER ( LEN = * ),INTENT(IN):: Name CHARACTER ( LEN =Length_Message):: Text ! ! Check if file is connected ! -------------------------- INQUIRE ( UNIT = Unit, OPENED = Unit_Connected ) IF ( .NOT. Unit_Connected ) & & CALL CTN_Error_Interception ! ! Rewind file ! ----------- REWIND ( Unit ) ! ! Find message ! ------------ DO READ ( Unit, "(A)", IOSTAT = IO_Stat ) Text IF ( IO_Stat .NE. 0 ) & & CALL CTN_Error_Interception IF ( Text(1:10) .EQ. New_message ) THEN READ ( UNIT = Unit, FMT = *, IOSTAT = IO_Stat ) & & Number IF ( IO_Stat .NE. 0 ) & & CALL CTN_Error_Interception IF ( Number .EQ. Message ) & & EXIT ENDIF ENDDO ! ! Read line ! --------- DO k = 1, Line READ ( Unit, "(A)", IOSTAT = IO_Stat ) Text IF ( IO_Stat .NE. 0 ) & & CALL CTN_Error_Interception IF ( Text(1:10) .EQ. New_message ) & & CALL CTN_Error_Interception ENDDO ! ! Output ! ------ Read_Message = Text ! ! Error interception ! ------------------ CONTAINS SUBROUTINE CTN_Error_Interception ! Text = " ERROR IN ROUTINE " // TRIM(Name) // "!" CALL Ausgabe ( Screen, TRIM(Text) // "!", "(/A)" ) WRITE ( Text, "(A,I5,A,I3)" ) " MESSAGE NOT FOUND:", & & Message, " -", Line CALL Ausgabe ( Screen, TRIM(Text), "(A/)" ) Read_Message = Text RETURN ! END SUBROUTINE CTN_Error_Interception ! END FUNCTION Read_Message ! ! !======================================================================! ! End: Module MODULE_SPRACHE !======================================================================! ! END MODULE MODULE_SPRACHE !
Thanks for reporting! Here is a reduction of your bug (gfortran-20050602 on i386-linux): $ cat a-stripped.f90 module foo character(len=l) :: s contains end module foo $ gfortran a-stripped.f90 a-stripped.f90:0: internal compiler error: in lhd_set_decl_assembler_name, at langhooks.c:165 The internal compiler error is a bug in gfortran. Meanwhile, I don't understand how your code (file module_io) is supposed to work: bufferString is declared as CHARACTER ( LEN = Input_String_Length ):: bufferString but Input_String_Length is not declared!
Subject: Re: internal compiler error: inlhd_set_decl_assembler_name, at langhooks.c:165 Hi! Erm... I just removed as much as possible to avoid having too much code (from 1173 to 230 lines), but I just tried to avoid syntax errors and stuff like that, I didn't even attempt to still have something meaningful... "Input_String_Length" should actually be imported from (yet) another module: I didn't mean to leave it unitialised: would it change something? (for the record I think it's set to 250). The whole thing is definitly a bit tortured, but this can happen when some code has been growing a lot organically... Thanks! Philippe fxcoudert at gcc dot gnu dot org wrote: > > ------- Additional Comments From fxcoudert at gcc dot gnu dot org 2005-06-02 11:41 ------- > Thanks for reporting! Here is a reduction of your bug (gfortran-20050602 on > i386-linux): > > $ cat a-stripped.f90 > module foo > character(len=l) :: s > contains > end module foo > $ gfortran a-stripped.f90 > a-stripped.f90:0: internal compiler error: in lhd_set_decl_assembler_name, at > langhooks.c:165 > > The internal compiler error is a bug in gfortran. Meanwhile, I don't understand > how your code (file module_io) is supposed to work: bufferString is declared as > CHARACTER ( LEN = Input_String_Length ):: bufferString > but Input_String_Length is not declared! > > -- > What |Removed |Added > ---------------------------------------------------------------------------- > Status|UNCONFIRMED |NEW > Ever Confirmed| |1 > Keywords| |ice-on-invalid-code > Last reconfirmed|0000-00-00 00:00:00 |2005-06-02 11:41:45 > date| | > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21877 > > ------- You are receiving this mail because: ------- > You reported the bug, or are watching the reporter.
I think you are seeing two different errors: one with your full code, and one with your reduced testcase. Perhaps the best thing would be for you to send me (via private mail) your code so that I can reduce it to the spot the original bug.
Philippe sent me his code. Proper reduction showed that his initial bug is PR 17911. I leave this PR open for the following bug: $ cat a-stripped.f90 module foo character(len=l) :: s contains end module foo $ gfortran a-stripped.f90 a-stripped.f90:0: internal compiler error: in lhd_set_decl_assembler_name, at langhooks.c:165
I messed up comment #4: the PR for the original bug is PR 19546.
This one now gives: Error: 's' at (1) must have constant character length in this context on trunk and 4.1 Fixed - thanks, Philippe! Paul