[Bug fortran/49397] [4.7/4.8/4.9 Regression] [F03] ICE with proc pointer assignment
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jan 30 23:49:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49397
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic,
| |ice-on-invalid-code
--- Comment #8 from Tobias Burnus <burnus at gcc dot gnu.org> ---
(In reply to Tobias Burnus from comment #0)
> Cf. Intepretation Request J3/11-198 at
> http://j3-fortran.org/doc/meeting/195/11-198.txt
That became Interpretation Request F08/0060 - see
http://j3-fortran.org/doc/year/13/13-006A.txt; passed all ballots and is part
of Fortran 2008 Corr. 2.
(In reply to janus from comment #5)
> Here is a reduced test case for the ICE:
> Print *,f()
> Contains
> Subroutine s
> Procedure(Real),Pointer :: p
> p => f
> End Subroutine
> End
The problem seems to be that "f" is not marked as external. That's fixed by the
patch below. [ICE on VALID CODE]
However, the following code still ICEs:
Contains
Subroutine s
Procedure(Real),Pointer :: p
p => g
End Subroutine
End
That's invalid (C729: "... or an external procedure that is accessed by use or
host association, referenced in the scoping unit as a procedure, or that has
the EXTERNAL attribute".)
Thus, we need to issue an error in this case. (ICE on INVALID) - it currently
ICEs even with the patch below.
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -2872,4 +2872,8 @@ resolve_function (gfc_expr *expr)
if (sym && is_external_proc (sym))
- resolve_global_procedure (sym, &expr->where,
- &expr->value.function.actual, 0);
+ {
+ resolve_global_procedure (sym, &expr->where,
+ &expr->value.function.actual, 0);
+ if (sym->attr.if_source == IFSRC_UNKNOWN)
+ sym->attr.external = 1;
+ }
More information about the Gcc-bugs
mailing list