aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/expr.c
diff options
context:
space:
mode:
authorJanus Weil <janus@gcc.gnu.org>2013-04-12 16:21:39 +0200
committerJanus Weil <janus@gcc.gnu.org>2013-04-12 16:21:39 +0200
commit96486998bca8f0d28e2b2dad664dfef10253ef4b (patch)
treeecbd9ece5aa64024cdfe55e5e8194d24f92be96f /gcc/fortran/expr.c
parent41b83758ed976b4dc502dfd9dd0133602b718c4b (diff)
downloadgcc-96486998bca8f0d28e2b2dad664dfef10253ef4b.zip
gcc-96486998bca8f0d28e2b2dad664dfef10253ef4b.tar.gz
gcc-96486998bca8f0d28e2b2dad664dfef10253ef4b.tar.bz2
re PR fortran/56261 ([OOP] seg fault call procedure pointer on polymorphic array)
2013-04-12 Janus Weil <janus@gcc.gnu.org> PR fortran/56261 * gfortran.h (gfc_explicit_interface_required): New prototype. * expr.c (gfc_check_pointer_assign): Check if an explicit interface is required in a proc-ptr assignment. * interface.c (check_result_characteristics): Extra check. * resolve.c (gfc_explicit_interface_required): New function. (resolve_global_procedure): Use new function 'gfc_explicit_interface_required'. Do a full interface check. 2013-04-12 Janus Weil <janus@gcc.gnu.org> PR fortran/56261 * gfortran.dg/auto_char_len_4.f90: Add -pedantic. Changed error. * gfortran.dg/assumed_rank_4.f90: Modified error wording. * gfortran.dg/block_11.f90: Fix invalid test case. * gfortran.dg/function_types_3.f90: Add new error message. * gfortran.dg/global_references_1.f90: Ditto. * gfortran.dg/import2.f90: Remove unneeded parts. * gfortran.dg/import6.f90: Fix invalid test case. * gfortran.dg/proc_decl_2.f90: Ditto. * gfortran.dg/proc_decl_9.f90: Ditto. * gfortran.dg/proc_decl_18.f90: Ditto. * gfortran.dg/proc_ptr_40.f90: New. * gfortran.dg/whole_file_7.f90: Modified error wording. * gfortran.dg/whole_file_16.f90: Ditto. * gfortran.dg/whole_file_17.f90: Add -pedantic. * gfortran.dg/whole_file_18.f90: Modified error wording. * gfortran.dg/whole_file_20.f03: Ditto. * gfortran.fortran-torture/execute/intrinsic_associated.f90: Fix invalid test case. From-SVN: r197922
Diffstat (limited to 'gcc/fortran/expr.c')
-rw-r--r--gcc/fortran/expr.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/fortran/expr.c b/gcc/fortran/expr.c
index 1a531d9..829b087 100644
--- a/gcc/fortran/expr.c
+++ b/gcc/fortran/expr.c
@@ -3556,6 +3556,22 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue)
if (s1 == s2 || !s1 || !s2)
return true;
+ /* F08:7.2.2.4 (4) */
+ if (s1->attr.if_source == IFSRC_UNKNOWN
+ && gfc_explicit_interface_required (s2, err, sizeof(err)))
+ {
+ gfc_error ("Explicit interface required for '%s' at %L: %s",
+ s1->name, &lvalue->where, err);
+ return false;
+ }
+ if (s2->attr.if_source == IFSRC_UNKNOWN
+ && gfc_explicit_interface_required (s1, err, sizeof(err)))
+ {
+ gfc_error ("Explicit interface required for '%s' at %L: %s",
+ s2->name, &rvalue->where, err);
+ return false;
+ }
+
if (!gfc_compare_interfaces (s1, s2, name, 0, 1,
err, sizeof(err), NULL, NULL))
{