summaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>2012-06-08 17:26:11 +0000
committerjanus <janus@138bc75d-0d04-0410-961f-82ee72b054a4>2012-06-08 17:26:11 +0000
commitc73f762d00e5e7a55f9256fac839b406bbb1c51b (patch)
tree8d289d12a300ed4e057d71380dc78973a09d46df /gcc/fortran
parentaac15713122ec9ba16371433b87a3a8909415b7e (diff)
downloadgcc-c73f762d00e5e7a55f9256fac839b406bbb1c51b.tar.gz
2012-06-08 Janus Weil <janus@gcc.gnu.org>
PR fortran/52552 * match.c (gfc_match_allocate): Modify order of checks. Change wording of error message. Remove FIXME note. * resolve.c (resolve_allocate_expr): Add a comment. 2012-06-08 Janus Weil <janus@gcc.gnu.org> PR fortran/52552 * gfortran.dg/allocate_alloc_opt_1.f90: Modified. * gfortran.dg/allocate_class_1.f90: Modified. * gfortran.dg/allocate_with_typespec_4.f90: Modified. * gfortran.dg/allocate_class_2.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@188335 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog7
-rw-r--r--gcc/fortran/match.c44
-rw-r--r--gcc/fortran/resolve.c1
3 files changed, 30 insertions, 22 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index e51d5071d83..02b644544a6 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,10 @@
+2012-06-08 Janus Weil <janus@gcc.gnu.org>
+
+ PR fortran/52552
+ * match.c (gfc_match_allocate): Modify order of checks. Change wording
+ of error message. Remove FIXME note.
+ * resolve.c (resolve_allocate_expr): Add a comment.
+
2012-06-07 Thomas König <tkoenig@gcc.gnu.org>
PR fortran/52861
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c
index 29b6428ab92..3d63510b00b 100644
--- a/gcc/fortran/match.c
+++ b/gcc/fortran/match.c
@@ -3533,6 +3533,28 @@ gfc_match_allocate (void)
}
}
+ /* Check for F08:C628. */
+ sym = tail->expr->symtree->n.sym;
+ b1 = !(tail->expr->ref
+ && (tail->expr->ref->type == REF_COMPONENT
+ || tail->expr->ref->type == REF_ARRAY));
+ if (sym && sym->ts.type == BT_CLASS && sym->attr.class_ok)
+ b2 = !(CLASS_DATA (sym)->attr.allocatable
+ || CLASS_DATA (sym)->attr.class_pointer);
+ else
+ b2 = sym && !(sym->attr.allocatable || sym->attr.pointer
+ || sym->attr.proc_pointer);
+ b3 = sym && sym->ns && sym->ns->proc_name
+ && (sym->ns->proc_name->attr.allocatable
+ || sym->ns->proc_name->attr.pointer
+ || sym->ns->proc_name->attr.proc_pointer);
+ if (b1 && b2 && !b3)
+ {
+ gfc_error ("Allocate-object at %L is neither a data pointer "
+ "nor an allocatable variable", &tail->expr->where);
+ goto cleanup;
+ }
+
/* The ALLOCATE statement had an optional typespec. Check the
constraints. */
if (ts.type != BT_UNKNOWN)
@@ -3558,28 +3580,6 @@ gfc_match_allocate (void)
if (tail->expr->ts.type == BT_DERIVED)
tail->expr->ts.u.derived = gfc_use_derived (tail->expr->ts.u.derived);
- /* FIXME: disable the checking on derived types and arrays. */
- sym = tail->expr->symtree->n.sym;
- b1 = !(tail->expr->ref
- && (tail->expr->ref->type == REF_COMPONENT
- || tail->expr->ref->type == REF_ARRAY));
- if (sym && sym->ts.type == BT_CLASS && sym->attr.class_ok)
- b2 = !(CLASS_DATA (sym)->attr.allocatable
- || CLASS_DATA (sym)->attr.class_pointer);
- else
- b2 = sym && !(sym->attr.allocatable || sym->attr.pointer
- || sym->attr.proc_pointer);
- b3 = sym && sym->ns && sym->ns->proc_name
- && (sym->ns->proc_name->attr.allocatable
- || sym->ns->proc_name->attr.pointer
- || sym->ns->proc_name->attr.proc_pointer);
- if (b1 && b2 && !b3)
- {
- gfc_error ("Allocate-object at %L is neither a nonprocedure pointer "
- "nor an allocatable variable", &tail->expr->where);
- goto cleanup;
- }
-
if (gfc_peek_ascii_char () == '(' && !sym->attr.dimension)
{
gfc_error ("Shape specification for allocatable scalar at %C");
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 61a1381a073..85313186695 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -6986,6 +6986,7 @@ resolve_allocate_expr (gfc_expr *e, gfc_code *code)
}
}
+ /* Check for F08:C628. */
if (allocatable == 0 && pointer == 0)
{
gfc_error ("Allocate-object at %L must be ALLOCATABLE or a POINTER",