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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |egallager at gcc dot gnu.org
           Severity|normal                      |minor

--- Comment #6 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to kargl from comment #5)
> 
> So, I looked at this on my i586-*-freebsd system.  Internal state seems
> to be corrupted.  The problem can be avoided by the following patch
> 
> Index: resolve.c
> ===================================================================
> --- resolve.c (revision 260808)
> +++ resolve.c (working copy)
> @@ -2937,16 +2937,23 @@ is_external_proc (gfc_symbol *sym)
>  /* Figure out if a function reference is pure or not.  Also set the name
>     of the function for a potential error message.  Return nonzero if the
>     function is PURE, zero if not.  */
> +
>  static int
>  pure_stmt_function (gfc_expr *, gfc_symbol *);
>  
>  static int
>  pure_function (gfc_expr *e, const char **name)
>  {
> -  int pure;
> +  int error_count, pure;
>    gfc_component *comp;
>  
>    *name = NULL;
> +
> +  /* If gfortran gets here with an issued error and a BT_UNKNOWN type,
> +     something has corrupted internal state.  Die instead of an ICE.  */
> +  gfc_get_errors (NULL, &error_count);
> +  if (error_count > 0 && e->ts.type == BT_UNKNOWN)
> +    gfc_fatal_error ("Invalid Fortran detected");
>  
>    if (e->symtree != NULL
>          && e->symtree->n.sym != NULL

Please send the patch to gcc-patches for review

Reply via email to