[Bug fortran/46459] ICE (segfault): Invalid read in compare_actual_formal [error recovery]

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Nov 9 10:59:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46459

--- Comment #9 from janus at gcc dot gnu.org ---
(In reply to janus from comment #8)
> As mentioned by Harald, the patch in comment 1 works well and is close to
> obvious.


I verified that it regtests cleanly. Adapted to current trunk it looks like
this:

Index: gcc/fortran/interface.c
===================================================================
--- gcc/fortran/interface.c     (Revision 241993)
+++ gcc/fortran/interface.c     (Arbeitskopie)
@@ -3190,6 +3190,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gf
         shape array, if the dummy argument has the VOLATILE attribute.  */

       if (f->sym->attr.volatile_
+         && a->expr->expr_type == EXPR_VARIABLE
          && a->expr->symtree->n.sym->as
          && a->expr->symtree->n.sym->as->type == AS_ASSUMED_SHAPE
          && !(f->sym->as && f->sym->as->type == AS_ASSUMED_SHAPE))
@@ -3219,6 +3220,7 @@ compare_actual_formal (gfc_actual_arglist **ap, gf
         dummy argument has the VOLATILE attribute.  */

       if (f->sym->attr.volatile_
+         && a->expr->expr_type == EXPR_VARIABLE
          && a->expr->symtree->n.sym->attr.pointer
          && a->expr->symtree->n.sym->as
          && !(f->sym->as


More information about the Gcc-bugs mailing list