From a1ab6660ae5b348d625af230f78bbe28556b2a45 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Sun, 4 Jan 2009 23:17:37 +0000 Subject: re PR fortran/38665 (ICE in check_host_association) 2009-01-05 Paul Thomas PR fortran/38665 * gfortran.h : Add bit to gfc_expr 'user_operator' * interface.c (gfc_extend_expr): Set the above if the operator is substituted by a function. * resolve.c (check_host_association): Return if above is set. 2009-01-05 Paul Thomas PR fortran/38665 * gfortran.dg/host_assoc_function_5.f90: New test. From-SVN: r143064 --- gcc/fortran/ChangeLog | 8 ++++++++ gcc/fortran/gfortran.h | 4 ++++ gcc/fortran/interface.c | 1 + gcc/fortran/resolve.c | 12 +++++++++++- 4 files changed, 24 insertions(+), 1 deletion(-) (limited to 'gcc/fortran') diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 2bf2a01..b8fdb3b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2009-01-05 Paul Thomas + + PR fortran/38665 + * gfortran.h : Add bit to gfc_expr 'user_operator' + * interface.c (gfc_extend_expr): Set the above if the operator + is substituted by a function. + * resolve.c (check_host_association): Return if above is set. + 2009-01-04 Mikael Morin PR fortran/35681 diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h index bb2230d..920fbd9 100644 --- a/gcc/fortran/gfortran.h +++ b/gcc/fortran/gfortran.h @@ -1553,6 +1553,10 @@ typedef struct gfc_expr /* Sometimes, when an error has been emitted, it is necessary to prevent it from recurring. */ unsigned int error : 1; + + /* Mark and expression where a user operator has been substituted by + a function call in interface.c(gfc_extend_expr). */ + unsigned int user_operator : 1; /* Used to quickly find a given constructor by its offset. */ splay_tree con_by_offset; diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index 17f7033..f779dfa 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -2670,6 +2670,7 @@ gfc_extend_expr (gfc_expr *e) e->value.function.esym = NULL; e->value.function.isym = NULL; e->value.function.name = NULL; + e->user_operator = 1; if (gfc_pure (NULL) && !gfc_pure (sym)) { diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 27a4d99..74f8fb0 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -4300,7 +4300,12 @@ check_host_association (gfc_expr *e) int n; bool retval = e->expr_type == EXPR_FUNCTION; - if (e->symtree == NULL || e->symtree->n.sym == NULL) + /* If the expression is the result of substitution in + interface.c(gfc_extend_expr) because there is no way in + which the host association can be wrong. */ + if (e->symtree == NULL + || e->symtree->n.sym == NULL + || e->user_operator) return retval; old_sym = e->symtree->n.sym; @@ -4336,6 +4341,11 @@ check_host_association (gfc_expr *e) gfc_free (e->shape); } +/* TODO - Replace this gfc_match_rvalue with a straight replacement of + actual arglists for function to function substitutions and with a + conversion of the reference list to an actual arglist in the case of + a variable to function replacement. This should be quite easy since + only integers and vectors can be involved. */ gfc_match_rvalue (&expr); gfc_clear_error (); gfc_buffer_error (0); -- cgit v1.1