[Bug fortran/49397] [4.7/4.8/4.9 Regression] [F03] ICE with proc pointer assignment
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49397 --- Comment #14 from Tobias Burnus burnus at gcc dot gnu.org --- Author: burnus Date: Wed Feb 19 23:32:46 2014 New Revision: 207927 URL: http://gcc.gnu.org/viewcvs?rev=207927root=gccview=rev Log: 2014-02-19 Tobias Burnus bur...@net-b.de PR fortran/49397 * expr.c (gfc_check_pointer_assign): Add check for F2008Cor2, C729. * trans-decl.c (gfc_get_symbol_decl): Correctly generate external decl in a corner case. 2014-02-19 Tobias Burnus bur...@net-b.de PR fortran/49397 * gfortran.dg/proc_ptr_45.f90: New. * gfortran.dg/proc_ptr_46.f90: New. Added: branches/gcc-4_8-branch/gcc/testsuite/gfortran.dg/proc_ptr_45.f90 branches/gcc-4_8-branch/gcc/testsuite/gfortran.dg/proc_ptr_46.f90 Modified: branches/gcc-4_8-branch/gcc/fortran/ChangeLog branches/gcc-4_8-branch/gcc/fortran/expr.c branches/gcc-4_8-branch/gcc/fortran/trans-decl.c branches/gcc-4_8-branch/gcc/testsuite/ChangeLog
[Bug fortran/49397] [4.7/4.8/4.9 Regression] [F03] ICE with proc pointer assignment
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49397 Tobias Burnus burnus at gcc dot gnu.org changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED Target Milestone|4.7.4 |4.8.3 --- Comment #15 from Tobias Burnus burnus at gcc dot gnu.org --- Fixed on the trunk (4.9) and on the 4.8 branch. For 4.7, the valid test case fails due to other bugs. Thus, I decided it is not worthwhile to adapt the patch for 4.7. Hence, I close this bug as FIXED.
[Bug fortran/49397] [4.7/4.8/4.9 Regression] [F03] ICE with proc pointer assignment
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49397 Tobias Burnus burnus at gcc dot gnu.org changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |burnus at gcc dot gnu.org --- Comment #10 from Tobias Burnus burnus at gcc dot gnu.org --- Patch http://gcc.gnu.org/ml/gcc-patches/2014-02/msg01065.html
[Bug fortran/49397] [4.7/4.8/4.9 Regression] [F03] ICE with proc pointer assignment
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49397 --- Comment #11 from Tobias Burnus burnus at gcc dot gnu.org --- Author: burnus Date: Tue Feb 18 22:09:39 2014 New Revision: 207854 URL: http://gcc.gnu.org/viewcvs?rev=207854root=gccview=rev Log: 2014-02-18 Tobias Burnus bur...@net-b.de PR fortran/49397 * expr.c (gfc_check_pointer_assign): Add check for F2008Cor2, C729. * trans-decl.c (gfc_get_symbol_decl): Correctly generate * external decl in a corner case. 2014-02-18 Tobias Burnus bur...@net-b.de PR fortran/49397 * gfortran.dg/proc_ptr_45.f90: New. * gfortran.dg/proc_ptr_46.f90: New. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/expr.c trunk/gcc/fortran/trans-decl.c trunk/gcc/testsuite/ChangeLog
[Bug fortran/49397] [4.7/4.8/4.9 Regression] [F03] ICE with proc pointer assignment
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49397 --- Comment #12 from janus at gcc dot gnu.org --- (In reply to Tobias Burnus from comment #11) Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/expr.c trunk/gcc/fortran/trans-decl.c trunk/gcc/testsuite/ChangeLog Seems like you forgot to svn add the test cases?
[Bug fortran/49397] [4.7/4.8/4.9 Regression] [F03] ICE with proc pointer assignment
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49397 --- Comment #13 from Tobias Burnus burnus at gcc dot gnu.org --- Author: burnus Date: Tue Feb 18 22:29:00 2014 New Revision: 207855 URL: http://gcc.gnu.org/viewcvs?rev=207855root=gccview=rev Log: Really add the new testsuite files missing from commit r207854 2014-02-18 Tobias Burnus bur...@net-b.de PR fortran/49397 * gfortran.dg/proc_ptr_45.f90: New. * gfortran.dg/proc_ptr_46.f90: New. Added: trunk/gcc/testsuite/gfortran.dg/proc_ptr_45.f90 trunk/gcc/testsuite/gfortran.dg/proc_ptr_46.f90
[Bug fortran/49397] [4.7/4.8/4.9 Regression] [F03] ICE with proc pointer assignment
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; +}
[Bug fortran/49397] [4.7/4.8/4.9 Regression] [F03] ICE with proc pointer assignment
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49397 --- Comment #9 from Tobias Burnus burnus at gcc dot gnu.org --- (In reply to Tobias Burnus from comment #8) However, the following code still ICEs: That's fixed by the following patch. --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -3583,2 +3583,12 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr + /* Check F2008Cor2, C729. */ + if (!s2-attr.intrinsic s2-attr.if_source == IFSRC_UNKNOWN + !s2-attr.external !s2-attr.subroutine !s2-attr.function) +{ + gfc_error (Procedure pointer target '%s' at %L must be either an + intrinsic, host or use associated, referenced or have + the EXTERNAL attribute, s2-name, rvalue-where); + return false; +} + return true;
[Bug fortran/49397] [4.7/4.8/4.9 Regression] [F03] ICE with proc pointer assignment
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49397 janus at gcc dot gnu.org changed: What|Removed |Added Summary|[F03] ICE with proc pointer |[4.7/4.8/4.9 Regression] |assignment |[F03] ICE with proc pointer ||assignment --- Comment #5 from janus at gcc dot gnu.org --- Here is a reduced test case for the ICE: Print *,f() Contains Subroutine s Procedure(Real),Pointer :: p p = f End Subroutine End No ICE with 4.4 and 4.5, but only with 4.6 and higher. Marking as regression.
[Bug fortran/49397] [4.7/4.8/4.9 Regression] [F03] ICE with proc pointer assignment
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49397 janus at gcc dot gnu.org changed: What|Removed |Added CC||rguenth at gcc dot gnu.org --- Comment #6 from janus at gcc dot gnu.org --- The ICE is probably due to this commit: http://gcc.gnu.org/viewcvs/gcc?view=revisionrevision=164928
[Bug fortran/49397] [4.7/4.8/4.9 Regression] [F03] ICE with proc pointer assignment
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49397 Richard Biener rguenth at gcc dot gnu.org changed: What|Removed |Added Target Milestone|--- |4.7.4
[Bug fortran/49397] [4.7/4.8/4.9 Regression] [F03] ICE with proc pointer assignment
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49397 --- Comment #7 from Richard Biener rguenth at gcc dot gnu.org --- 1776 || DECL_FILE_SCOPE_P (current_function_decl) also matches TRANSLATION_UNIT_DECL.