diff options
author | Mikael Morin <mikael@gcc.gnu.org> | 2015-03-25 10:15:46 +0000 |
---|---|---|
committer | Mikael Morin <mikael@gcc.gnu.org> | 2015-03-25 10:15:46 +0000 |
commit | 2b91aea838279a2fa5f2b09a8590e4007e87025e (patch) | |
tree | c467d63d03b1866427667378fe81a4fc6ad7d7ea /gcc | |
parent | bbf043c2d27b67d949912a3cdb2f9eb6fabcd51f (diff) | |
download | gcc-2b91aea838279a2fa5f2b09a8590e4007e87025e.zip gcc-2b91aea838279a2fa5f2b09a8590e4007e87025e.tar.gz gcc-2b91aea838279a2fa5f2b09a8590e4007e87025e.tar.bz2 |
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.
From-SVN: r221657
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/fortran/gfortran.h | 3 | ||||
-rw-r--r-- | gcc/fortran/resolve.c | 5 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/data_initialized_3.f90 | 43 |
5 files changed, 65 insertions, 0 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 7c330c7..fb3a83d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2015-03-25 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/64952 + PR fortran/65532 + * 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. + 2015-03-24 Andre Vehreschild <vehre@gmx.de> PR fortran/55901 diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index 8e6595f..24d56c0 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -1691,6 +1691,9 @@ typedef struct gfc_namespace Holds -1 during resolution. */ signed resolved:2; + /* Set when resolve_types has been called for this namespace. */ + unsigned types_resolved:1; + /* Set to 1 if code has been generated for this namespace. */ unsigned translated:1; diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 2a24dfd..316b413 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -14942,6 +14942,9 @@ resolve_types (gfc_namespace *ns) gfc_equiv *eq; gfc_namespace* old_ns = gfc_current_ns; + if (ns->types_resolved) + return; + /* Check that all IMPLICIT types are ok. */ if (!ns->seen_implicit_none) { @@ -15016,6 +15019,8 @@ resolve_types (gfc_namespace *ns) gfc_resolve_omp_udrs (ns->omp_udr_root); + ns->types_resolved = 1; + gfc_current_ns = old_ns; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fe8092a..cf3b288 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2015-03-25 Mikael Morin <mikael@gcc.gnu.org> + + PR fortran/64952 + PR fortran/65532 + * gfortran.dg/data_initialized_3.f90: New. + 2015-03-25 Richard Biener <rguenther@suse.de> PR middle-end/65519 diff --git a/gcc/testsuite/gfortran.dg/data_initialized_3.f90 b/gcc/testsuite/gfortran.dg/data_initialized_3.f90 new file mode 100644 index 0000000..c3ca4b3 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/data_initialized_3.f90 @@ -0,0 +1,43 @@ +! { dg-do compile } +! +! PR fortran/65532 +! The partial initialization through data statements was producing +! shape mismatch errors. +! +! Contributed by Harald Anlauf <anlauf@gmx.de> + +module gfcbug131 + implicit none +contains + DOUBLE PRECISION FUNCTION d1mach(i) + INTEGER, INTENT(IN) :: i + + INTEGER :: small(4) + INTEGER :: large(4) + INTEGER :: right(4) + INTEGER :: diver(4) + INTEGER :: LOG10(4) + DOUBLE PRECISION :: dmach(5) + + EQUIVALENCE (dmach(1),small(1)) + EQUIVALENCE (dmach(2),large(1)) + EQUIVALENCE (dmach(3),right(1)) + EQUIVALENCE (dmach(4),diver(1)) + EQUIVALENCE (dmach(5),LOG10(1)) + + DATA small(1),small(2) / 0, 1048576 / + DATA large(1),large(2) / -1, 2146435071 / + DATA right(1),right(2) / 0, 1017118720 / + DATA diver(1),diver(2) / 0, 1018167296 / + DATA LOG10(1),LOG10(2) / 1352628735, 1070810131 / + + d1mach = dmach(i) + END FUNCTION d1mach + + DOUBLE PRECISION FUNCTION foo (x) + DOUBLE PRECISION, INTENT(IN) :: x + foo = SQRT (d1mach(4)) + END FUNCTION foo + +end module gfcbug131 + |