Hi, I was in the process of translating a program written in f77 into f90 when this bug occurred. All I did was to add parameters to a function ; these parameters must correspond to the dimensions of arrays, as I want to allocate memory to them dynamically. I declared my arrays like: real*8,dimension(n1,n2) tab1, tab2 and n1 and n2 are the two variables I added in the parameters of my function. "$ gfc --version" gives: GNU Fortran 95 (GCC 4.1.0 20050413 (experimental)) Compilation options: -ffixed-line-length-132 -Wall -static I'm completely stuck because of this problem, therefore if you had the slightest idea, even just to get round this, I'd be *much* interested... Many thanks in advance !
Created attachment 8637 [details] Assembler file generated using the -save-temps option
Could you attach the .f90 file?
Sure. Actually the main file is a .F file. The tgz I'm about to attach contain the following files: - main.F : main file - guess.h params.h pinch_complet.h prec.h: included by the preprocessor - routines.h.ok : when renamed to routines.h, the program compiles fine - routines.h.bug: when renamed to routines.h, causes the bug to appear "$ diff routines.*" gives: 408c408 < subroutine solution(n,xf,fg,h1,h2,beta,pas,tolerance,nmax,xav) --- > subroutine solution(xf,fg,h1,h2,beta,pas,tolerance,nmax,xav) 438c438 < parameter (n1=5,n2=5,ndims=10) --- > parameter (n1=5,n2=5,n=1024,ndims=10) All I did was to add "n" as a new parameter of the solution() subroutine ; here the call to solution() is unchanged but adding a variable corresponding to n in the function call changes nothing, the bug still appears. Thanks again, cheers
Created attachment 8639 [details] Source files
Reduced testcase is: $ cat pr21034.f subroutine solution(n) implicit none integer n real dte(n) save print *, dte end $ gfortran -c pr21034.f pr21034.f: In function ‘solution’: pr21034.f:4: internal compiler error: in gfc_trans_auto_array_allocation, at fortran/trans-array.c:3036 Please note that if "print *,dte" is replaced by any other statement using dte (such as "dte(:) = 0" or "call anothersub(dte)"), the bug is the same. Removing this line, removing the "save" statement or make n a parameter lead to correct compilation.
Subject: Bug 21034 CVSROOT: /cvs/gcc Module name: gcc Changes by: pbrook@gcc.gnu.org 2005-06-22 15:34:02 Modified files: gcc/fortran : ChangeLog symbol.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gfortran.dg: auto_save_1.f90 Log message: 2005-06-22 Paul Brook <paul@codesourcery.com> PR fortran/21034 * symbol.c (gfc_is_var_automatic): New function. (save_symbol): Use it. testsuite/ * gfortran.dg/auto_save_1.f90: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.470&r2=1.471 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/symbol.c.diff?cvsroot=gcc&r1=1.29&r2=1.30 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5670&r2=1.5671 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/auto_save_1.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1
Fixed.
What about 4.0? Right now, we've been trying to keep all patches applied on both branches. Doesn't this bug happen on 4.0 too?
Reopening until 4.0 is unforzen and the patch applied there
Subject: Bug 21034 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: pbrook@gcc.gnu.org 2005-07-15 15:21:21 Modified files: gcc/fortran : ChangeLog symbol.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gfortran.dg: auto_save_1.f90 Log message: 2005-07-15 Paul Brook <paul@codesourcery.com> Backport form mainline. 2005-06-22 Paul Brook <paul@codesourcery.com> PR fortran/21034 * symbol.c (gfc_is_var_automatic): New function. (save_symbol): Use it. testsuite/ * gfortran.dg/auto_save_1.f90: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.335.2.90&r2=1.335.2.91 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/symbol.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.26.2.1&r2=1.26.2.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.277&r2=1.5084.2.278 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/auto_save_1.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.8.1
Fix applied to 4.0-branch.
*** Bug 23091 has been marked as a duplicate of this bug. ***