From: janus Date: Sat, 1 Jun 2013 21:36:33 +0000 (+0000) Subject: 2013-06-01 Janus Weil X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=bae9d5f12010bf379fa07a350fdf07f4b1506add 2013-06-01 Janus Weil Tobias Burnus PR fortran/57217 * interface.c (check_dummy_characteristics): Symmetrize type check. 2013-06-01 Janus Weil Tobias Burnus PR fortran/57217 * gfortran.dg/typebound_override_4.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@199586 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 97893b97950..7f6fa7a3e7c 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2013-06-01 Janus Weil + Tobias Burnus + + PR fortran/57217 + * interface.c (check_dummy_characteristics): Symmetrize type check. + 2013-05-22 Janne Blomqvist * intrinsic.texi (RANDOM_SEED): Improve example. diff --git a/gcc/fortran/interface.c b/gcc/fortran/interface.c index e1f0cb6b2f8..0278995ba52 100644 --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -987,7 +987,8 @@ check_dummy_characteristics (gfc_symbol *s1, gfc_symbol *s2, bool type_must_agree, char *errmsg, int err_len) { /* Check type and rank. */ - if (type_must_agree && !compare_type_rank (s2, s1)) + if (type_must_agree && + (!compare_type_rank (s1, s2) || !compare_type_rank (s2, s1))) { if (errmsg != NULL) snprintf (errmsg, err_len, "Type/rank mismatch in argument '%s'", diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e8b54e4fb14..d156c635db7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2013-06-01 Janus Weil + Tobias Burnus + + PR fortran/57217 + * gfortran.dg/typebound_override_4.f90: New. + 2013-05-26 Eric Botcazou * gnat.dg/specs/last_bit.ads: New test. diff --git a/gcc/testsuite/gfortran.dg/typebound_override_4.f90 b/gcc/testsuite/gfortran.dg/typebound_override_4.f90 new file mode 100644 index 00000000000..2b747a87b6e --- /dev/null +++ b/gcc/testsuite/gfortran.dg/typebound_override_4.f90 @@ -0,0 +1,34 @@ +! { dg-do compile } +! +! PR 57217: [4.7/4.8/4.9 Regression][OOP] Accepts invalid TBP overriding - lacking arguments check +! +! Contributed by Salvatore Filippone + +module base_mod + implicit none + type base_type + contains + procedure, pass(map) :: clone => base_clone + end type +contains + subroutine base_clone(map,mapout) + class(base_type) :: map + class(base_type) :: mapout + end subroutine +end module + +module r_mod + use base_mod + implicit none + type, extends(base_type) :: r_type + contains + procedure, pass(map) :: clone => r_clone ! { dg-error "Type/rank mismatch in argument" } + end type +contains + subroutine r_clone(map,mapout) + class(r_type) :: map + class(r_type) :: mapout + end subroutine +end module + +! { dg-final { cleanup-modules "base_mod r_mod" } }