the fortran compiler crashes when trying to compile the following test program : subroutine probleme(p) real(kind=8), dimension(:) :: p integer :: nx = size(p, 1) integer :: nix nix = nx end subroutine The error reported by the compiler is : test.f: In function ‘probleme’: test.f:2: erreur interne du compilateur: dans gfc_conv_constant, à fortran/trans-const.c:348 Veuillez soumettre un rapport complet d'anomalies, avec le source pré-traité si nécessaire. Consultez <URL:http://gcc.gnu.org/bugs.html> pour plus de détail. The compilation command was : gfortran test.f The gfortran -v is : Lecture des spécification à partir de /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/specs Target: x86_64-pc-linux-gnu Configuré avec: /usr/src/gcc-4.1.2/configure --host=x86_64-pc-linux-gnu --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --enable-threads=posix --with-system-zlib --enable-languages=f95 --disable-multilib Modèle de thread: posix version gcc 4.1.2
Created attachment 13223 [details] the test program that fails
the attached program (test.f) fails to compile: the compilation command is : gfortran -c test.f the error is : test.f: In function ‘probleme’: test.f:2: erreur interne du compilateur: dans gfc_conv_constant, à fortran/trans-const.c:348 Veuillez soumettre un rapport complet d'anomalies, avec le source pré-traité si nécessaire. Consultez <URL:http://gcc.gnu.org/bugs.html> pour plus de détail. the fortran version is (gfortran -v) : Lecture des spécification à partir de /usr/lib/gcc/x86_64-pc-linux-gnu/4.1.2/specs Target: x86_64-pc-linux-gnu Configuré avec: /usr/src/gcc-4.1.2/configure --host=x86_64-pc-linux-gnu --prefix=/usr --infodir=/usr/share/info --mandir=/usr/share/man --enable-threads=posix --with-system-zlib --enable-languages=f95 --disable-multilib Modèle de thread: posix version gcc 4.1.2
Confirmed with 4.3.0.
*** Bug 31252 has been marked as a duplicate of this bug. ***
Created attachment 13225 [details] a test program that does not fail
I think test.f is not valid Fortran, because size(p,1) is not a valid specification expression. See 7.1.6 of the F2003 standard: it is a array inquiry function (size) with an argument that is a variable (p) whose properties inquired about *are dependent* on the upper bound of the last dimension of an assumed-size array. So, it's invalid. Now, we actually accept it because SIZE is a specification inquiry, and we don't check things any further. This part (check_inquiry and its callers in expr.c) need some rewriting to go along with the standard.
Subject: Bug 31253 Author: dfranke Date: Sun Jul 22 16:31:11 2007 New Revision: 126826 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126826 Log: gcc/fortran: 2007-07-22 Daniel Franke <franke.daniel@gmail.com> PR fortran/29962 PR fortran/31253 PR fortran/31265 PR fortran/31639 * gfortran.h (gfc_intrinsic_sym): Changed members elemental, pure, generic, specific, actual_ok, noreturn into bits of a bitfield, added bits for inquiry, transformational, conversion. * check.c (non_init_transformational): Removed, removed all callers. * intrinsic.c (enum class): New. (add_sym*): Replaced argument elemetal by enum class. Changed all callers. (add_functions): Assign appropriate classes to intrinsic functions. (add_subroutines): Assign appropriate classes to intrinsic subroutines. (add_conv): Set conversion attribute. (gfc_init_expr_extensions): Removed, removed all callers. (gfc_intrinsic_func_interface): Reimplemented check for non-standard initializatione expressions. * expr.c (check_specification_function): New. (gfc_is_constant_expr): Added check for specification functions. (check_init_expr_arguments): New. (check_inquiry): Changed return value to MATCH, added checks for inquiry functions defined by F2003. (check_transformational): New. (check_null): New. (check_elemental): New. (check_conversion): New. (check_init_expr): Call new check functions, add more specific error messages. gcc/testsuite: 2007-07-22 Daniel Franke <franke.daniel@gmail.com> PR fortran/29962 * gfortran.dg/array_initializer_1.f90: Removed warning. * gfortran.dg/initialization_1.f90: Adjusted messages. * gfortran.dg/nested_modules_6.f90: Removed warning. PR fortran/31253 * gfortran.dg/initialization_7.f90: New test. PR fortran/31639 * gfortran.dg/initialization_8.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/initialization_7.f90 trunk/gcc/testsuite/gfortran.dg/initialization_8.f90 Modified: trunk/gcc/fortran/check.c trunk/gcc/fortran/expr.c trunk/gcc/fortran/gfortran.h trunk/gcc/fortran/intrinsic.c trunk/gcc/testsuite/gfortran.dg/array_initializer_1.f90 trunk/gcc/testsuite/gfortran.dg/initialization_1.f90 trunk/gcc/testsuite/gfortran.dg/nested_modules_6.f90
Fixed in trunk. Closing.