* the exact version of GCC; > gfortran -v Utilisation des specs internes. Target: i386-redhat-linux Configuré avec: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --host=i386-redhat-linux Modèle de thread: posix version gcc 4.0.1 20050727 (Red Hat 4.0.1-5) * the system type; > cat /proc/version Linux version 2.6.13-1.1526_FC4smp (bhcompile@hs20-bc1-6.build.redhat.com) (gcc version 4.0.1 20050727 (Red Hat 4.0.1-5)) #1 SMP Wed Sep 28 19:30:04 EDT 2005 * the options given when GCC was configured/built; > gfortran -v -save-temps -c bug.f90 GNU F95 version 4.0.1 20050727 (Red Hat 4.0.1-5) (i386-redhat-linux) compiled by GNU C version 4.0.1 20050727 (Red Hat 4.0.1-5). heuristiques GGC: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 * the complete command line that triggers the bug; gfortran -c bug.f90 * the compiler output (error messages, warnings, etc.); and > gfortran -c bug.f90 bug.f90: In function ‘s_to_c’: bug.f90:21: erreur interne du compilateur: dans gfc_finish_var_decl, à fortran/trans-decl.c:436 Veuillez soumettre un rapport complet d'anomalies, avec le source pré-traité si nécessaire. Consultez <URL:http://bugzilla.redhat.com/bugzilla> pour plus de détail. * the preprocessed file (*.i*) that triggers the bug, generated by adding -save-temps to the complete compilation command, or, in the case of a bug report for the GNAT front end, a complete set of source files (see below). > cat bug.f90 MODULE ISO_VARYING_STRING PRIVATE TYPE VARYING_STRING PRIVATE CHARACTER,DIMENSION(:),POINTER :: chars ENDTYPE VARYING_STRING CHARACTER,PARAMETER :: blank = " " PUBLIC :: s_to_c CONTAINS FUNCTION s_to_c(string) type(VARYING_STRING),INTENT(IN) :: string ! returns the characters of string as an automatically sized character CHARACTER(LEN=SIZE(string%chars)) :: s_to_c INTEGER :: lc lc=SIZE(string%chars) DO i=1,lc s_to_c(i:i) = string%chars(i) ENDDO ENDFUNCTION s_to_c END MODULE ISO_VARYING_STRING
Here is what I get with the mainline of GCC: In file t.f90:12 PUBLIC :: s_to_c 1 Error: 'string' is a PRIVATE type and cannot be a dummy argument of 's_to_c', which is PUBLIC at (1)
(In reply to comment #1) > Here is what I get with the mainline of GCC: > In file t.f90:12 > > PUBLIC :: s_to_c > 1 > Error: 'string' is a PRIVATE type and cannot be a dummy argument of 's_to_c', > which is PUBLIC at (1) Gfortran is correct; the code is invalid. However, if we make it valid by declaring the type VARYING_STRING public too, we get the error message of the OP. Here's a reduced testcase kl-nrb:~$ cat hum.f90 MODULE ISO_VARYING_STRING CONTAINS FUNCTION s_to_c(chars) CHARACTER,DIMENSION(:),POINTER :: chars CHARACTER(LEN=SIZE(chars)) :: s_to_c s_to_c = '' ENDFUNCTION s_to_c END MODULE ISO_VARYING_STRING kl-nrb:~$ gfortran hum.f90 hum.f90: In function 's_to_c': hum.f90:5: internal compiler error: in gfc_finish_var_decl, at fortran/trans-decl.c:444 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. I think I've seen this bug reported somewhere, but couldn't find it in a quick search.
(In reply to comment #2) > I think I've seen this bug reported somewhere, but couldn't find it in a quick > search. Looks to be PR 23675.
(In reply to comment #3) > (In reply to comment #2) > > I think I've seen this bug reported somewhere, but couldn't find it in a quick > > search. > Looks to be PR 23675. Yes, they seem to be the same, except that PR 23675 demonstrates an other bug as well, namely the same one as in PR 22607. I confirm this bug, and mark it as blocking PR 23675, and will do the same with PR 22607 (another possibility would be to mark both this and PR 22607 as duplicates of PR 23675, but since they are separate bugs I think there is some value in keeping them as separate PR:s)
Patch here: http://gcc.gnu.org/ml/fortran/2005-10/msg00587.html
*** This bug has been marked as a duplicate of 18883 ***