Created attachment 35119 [details] Bug demo. Dear all, after updating to trunk rev. 221607, I found a problem which I reduced to the attached example. Commenting out the call to d1mach or commenting out in d1mach the data statements in lines 21-25 makes the error messages disappear. Here's the error messages I get: % gfc-trunk -c gfcbug131.f90 gfcbug131.f90:10:23: INTEGER :: diver(4) 1 Error: Different shape for array assignment at (1) on dimension 1 (4 and 2) gfcbug131.f90:8:23: INTEGER :: large(4) 1 Error: Different shape for array assignment at (1) on dimension 1 (4 and 2) gfcbug131.f90:11:23: INTEGER :: LOG10(4) 1 Error: Different shape for array assignment at (1) on dimension 1 (4 and 2) gfcbug131.f90:9:23: INTEGER :: right(4) 1 Error: Different shape for array assignment at (1) on dimension 1 (4 and 2) gfcbug131.f90:7:23: INTEGER :: small(4) 1 Error: Different shape for array assignment at (1) on dimension 1 (4 and 2)
I found a workaround by changing the dimension of the arrays in lines 7-11 to 2 instead of 4 (the original code also supports dated hardware).
I suspect r221586: I don't see the errors at r221569. > I found a workaround by changing the dimension of the arrays in > lines 7-11 to 2 instead of 4 (the original code also supports > dated hardware). Confirmed.
It indeed is r221586.
With r221586, procedure d1mach is resolved more than once. At the first time resolve_values is called, the problematic variables (diver, large, etc) have a NULL sym->value, which is set afterwards in resolve_data. On the second call, the value is non-null and the error is produced.
As noted in 64952, this prevents 481.wrf from SPEC2006 being built
Patch posted: https://gcc.gnu.org/ml/gcc-patches/2015-03/msg01272.html
Author: mikael Date: Wed Mar 25 10:15:46 2015 New Revision: 221657 URL: https://gcc.gnu.org/viewcvs?rev=221657&root=gcc&view=rev Log: Fix regression introduced at revision 221586. PR fortran/64952 PR fortran/65532 fortran/ * gfortran.h (struct gfc_namespace): New field 'types_resolved'. * resolve.c (resolve_types): Return early if field 'types_resolved' is set. Set 'types_resolved' at the end. testsuite/ * gfortran.dg/data_initialized_3.f90: New. Added: trunk/gcc/testsuite/gfortran.dg/data_initialized_3.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/gfortran.h trunk/gcc/fortran/resolve.c trunk/gcc/testsuite/ChangeLog
Fixed. Closing.