aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorThomas Koenig <tkoenig@gcc.gnu.org>2009-09-07 15:23:15 +0000
committerThomas Koenig <tkoenig@gcc.gnu.org>2009-09-07 15:23:15 +0000
commit6c145259f5f92444bf315ab288fbbb58ec71be8a (patch)
treef5b0bed711483226ac36fcb9abc5e3564791ae5c /gcc/fortran
parent8ff7f8241579ba8823310c4f05e267f8a24951a2 (diff)
downloadgcc-6c145259f5f92444bf315ab288fbbb58ec71be8a.zip
gcc-6c145259f5f92444bf315ab288fbbb58ec71be8a.tar.gz
gcc-6c145259f5f92444bf315ab288fbbb58ec71be8a.tar.bz2
re PR fortran/41197 (ICE with ALLOCATE and nonscalar STAT= variable)
2009-09-07 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/41197 * resolve_c (resolve_allocate_deallocate): Complain if stat or errmsg varaible is an array. 2009-09-07 Thomas Koenig <tkoenig@gcc.gnu.org> PR fortran/41197 * gfortran.dg/allocate_alloc_opt_1.f90: Use scalar variables for stat and errmsg. * gfortran.dg/deallocate_alloc_opt_1.f90: Likewise. * gfortran.dg/allocate_stat_2.f90: New test. From-SVN: r151480
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/resolve.c16
2 files changed, 15 insertions, 7 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index c392d9d..d2a301d 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2009-09-07 Thomas Koenig <tkoenig@gcc.gnu.org>
+
+ PR fortran/41197
+ * resolve_c (resolve_allocate_deallocate): Complain
+ if stat or errmsg varaible is an array.
+
2009-09-05 Paul Thomas <pault@gcc.gnu.org>
PR fortran/41258
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index b665c35..fd365eb 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -5732,9 +5732,10 @@ resolve_allocate_deallocate (gfc_code *code, const char *fcn)
gfc_error ("Illegal stat-variable at %L for a PURE procedure",
&stat->where);
- if (stat->ts.type != BT_INTEGER
- && !(stat->ref && (stat->ref->type == REF_ARRAY
- || stat->ref->type == REF_COMPONENT)))
+ if ((stat->ts.type != BT_INTEGER
+ && !(stat->ref && (stat->ref->type == REF_ARRAY
+ || stat->ref->type == REF_COMPONENT)))
+ || stat->rank > 0)
gfc_error ("Stat-variable at %L must be a scalar INTEGER "
"variable", &stat->where);
@@ -5759,10 +5760,11 @@ resolve_allocate_deallocate (gfc_code *code, const char *fcn)
gfc_error ("Illegal errmsg-variable at %L for a PURE procedure",
&errmsg->where);
- if (errmsg->ts.type != BT_CHARACTER
- && !(errmsg->ref
- && (errmsg->ref->type == REF_ARRAY
- || errmsg->ref->type == REF_COMPONENT)))
+ if ((errmsg->ts.type != BT_CHARACTER
+ && !(errmsg->ref
+ && (errmsg->ref->type == REF_ARRAY
+ || errmsg->ref->type == REF_COMPONENT)))
+ || errmsg->rank > 0 )
gfc_error ("Errmsg-variable at %L must be a scalar CHARACTER "
"variable", &errmsg->where);