diff options
author | Janus Weil <janus@gcc.gnu.org> | 2019-03-27 23:40:22 +0100 |
---|---|---|
committer | Janus Weil <janus@gcc.gnu.org> | 2019-03-27 23:40:22 +0100 |
commit | 7076b27b7488bd8395310811a9c0d39ed5404490 (patch) | |
tree | fd50b2e9fc5cb909cf8ae451ab199db21cd69738 /gcc/fortran/expr.c | |
parent | 303d6cb2760304f5e6d00c4419c0dd1144588180 (diff) | |
download | gcc-7076b27b7488bd8395310811a9c0d39ed5404490.zip gcc-7076b27b7488bd8395310811a9c0d39ed5404490.tar.gz gcc-7076b27b7488bd8395310811a9c0d39ed5404490.tar.bz2 |
re PR fortran/85537 ([F08] Invalid memory reference at runtime when calling subroutine through procedure pointer)
fix PR 85537
2019-03-27 Janus Weil <janus@gcc.gnu.org>
PR fortran/85537
* expr.c (gfc_check_assign_symbol): Reject internal and dummy procedures
in procedure pointer initialization.
2019-03-27 Janus Weil <janus@gcc.gnu.org>
PR fortran/85537
* gfortran.dg/dummy_procedure_11.f90: Fix test case.
* gfortran.dg/pointer_init_11.f90: New test case.
From-SVN: r269980
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r-- | gcc/fortran/expr.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c index f54affa..478a555 100644 --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -4407,6 +4407,20 @@ gfc_check_assign_symbol (gfc_symbol *sym, gfc_component *comp, gfc_expr *rvalue) "may not be a procedure pointer", &rvalue->where); return false; } + if (attr.proc == PROC_INTERNAL) + { + gfc_error ("Internal procedure %qs is invalid in " + "procedure pointer initialization at %L", + rvalue->symtree->name, &rvalue->where); + return false; + } + if (attr.dummy) + { + gfc_error ("Dummy procedure %qs is invalid in " + "procedure pointer initialization at %L", + rvalue->symtree->name, &rvalue->where); + return false; + } } return true; |