aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/check.c
diff options
context:
space:
mode:
authorPaul Thomas <pault@gcc.gnu.org>2017-11-09 19:12:41 +0000
committerPaul Thomas <pault@gcc.gnu.org>2017-11-09 19:12:41 +0000
commit6e307219b955b80e6669acadae72c183f0eda248 (patch)
tree4afaf01334bb2ba941218b9e57539348c63c514c /gcc/fortran/check.c
parent1fb84d5b0a2dcdb8fd5aa39680df651811d55fbb (diff)
downloadgcc-6e307219b955b80e6669acadae72c183f0eda248.zip
gcc-6e307219b955b80e6669acadae72c183f0eda248.tar.gz
gcc-6e307219b955b80e6669acadae72c183f0eda248.tar.bz2
re PR fortran/78619 (ICE in copy_reference_ops_from_ref, at tree-ssa-sccvn.c:889)
2017-11-09 Paul Thomas <pault@gcc.gnu.org> PR fortran/78619 * check.c (same_type_check): Introduce a new argument 'assoc' with default value false. If this is true, use the symbol type spec of BT_PROCEDURE expressions. (gfc_check_associated): Set 'assoc' true in the call to 'same_type_check'. 2017-11-09 Paul Thomas <pault@gcc.gnu.org> PR fortran/78619 * gfortran.dg/pr78619.f90: New test. From-SVN: r254605
Diffstat (limited to 'gcc/fortran/check.c')
-rw-r--r--gcc/fortran/check.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c
index 914dbf9..a147449 100644
--- a/gcc/fortran/check.c
+++ b/gcc/fortran/check.c
@@ -427,15 +427,22 @@ less_than_bitsize2 (const char *arg1, gfc_expr *expr1, const char *arg2,
/* Make sure two expressions have the same type. */
static bool
-same_type_check (gfc_expr *e, int n, gfc_expr *f, int m)
+same_type_check (gfc_expr *e, int n, gfc_expr *f, int m, bool assoc = false)
{
gfc_typespec *ets = &e->ts;
gfc_typespec *fts = &f->ts;
- if (e->ts.type == BT_PROCEDURE && e->symtree->n.sym)
- ets = &e->symtree->n.sym->ts;
- if (f->ts.type == BT_PROCEDURE && f->symtree->n.sym)
- fts = &f->symtree->n.sym->ts;
+ if (assoc)
+ {
+ /* Procedure pointer component expressions have the type of the interface
+ procedure. If they are being tested for association with a procedure
+ pointer (ie. not a component), the type of the procedure must be
+ determined. */
+ if (e->ts.type == BT_PROCEDURE && e->symtree->n.sym)
+ ets = &e->symtree->n.sym->ts;
+ if (f->ts.type == BT_PROCEDURE && f->symtree->n.sym)
+ fts = &f->symtree->n.sym->ts;
+ }
if (gfc_compare_types (ets, fts))
return true;
@@ -1002,7 +1009,7 @@ gfc_check_associated (gfc_expr *pointer, gfc_expr *target)
}
t = true;
- if (!same_type_check (pointer, 0, target, 1))
+ if (!same_type_check (pointer, 0, target, 1, true))
t = false;
if (!rank_check (target, 0, pointer->rank))
t = false;