From: Jerry DeLisle Date: Fri, 15 Jul 2016 19:58:55 +0000 (+0000) Subject: re PR fortran/62125 (Nested select type not accepted (rejects valid)) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a07b81c7422349f3a104058af3ae192565a6a6f4;p=gcc.git re PR fortran/62125 (Nested select type not accepted (rejects valid)) 2016-07-15 Jerry DeLisle Marco Restelli PR fortran/62125 * symbol.c (select_type_insert_tmp): Recursively call self to take care of nested select type. * gfortran.dg/pr62125.f90: New test. Co-Authored-By: Marco Restelli From-SVN: r238400 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 51e8e2e55ef..82e90da0236 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,10 @@ +2016-07-15 Jerry DeLisle + Marco Restelli + + PR fortran/62125 + * symbol.c (select_type_insert_tmp): Recursively call self to take care + of nested select type. + 2016-07-15 Cesar Philippidis * openmp.c (gfc_match_omp_clauses): Scan for clause vector_length diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c index 0ee7decffd4..c967f25c858 100644 --- a/gcc/fortran/symbol.c +++ b/gcc/fortran/symbol.c @@ -2930,7 +2930,11 @@ select_type_insert_tmp (gfc_symtree **st) gfc_select_type_stack *stack = select_type_stack; for (; stack; stack = stack->prev) if ((*st)->n.sym == stack->selector && stack->tmp) - *st = stack->tmp; + { + *st = stack->tmp; + select_type_insert_tmp (st); + return; + } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9608c2b735c..2793b344fa1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-07-15 Jerry DeLisle + Marco Restelli + + PR fortran/62125 + * gfortran.dg/pr62125.f90: New test. + 2016-07-15 Bill Schmidt * gcc.target/powerpc/divkc3-1.c: Require p8vector support. diff --git a/gcc/testsuite/gfortran.dg/pr62125.f90 b/gcc/testsuite/gfortran.dg/pr62125.f90 new file mode 100644 index 00000000000..3256d05cba0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr62125.f90 @@ -0,0 +1,32 @@ +! { dg-do run } +! PR62125 Nested select type not accepted (rejects valid) +module m + implicit none + type, abstract :: t1 + logical :: l + end type t1 + type, extends(t1), abstract :: t2 + integer :: i + end type t2 + type, extends(t2) :: t3 + real :: x + end type t3 +contains + subroutine s(u) + class(t1), intent(in) :: u + if(.not.u%l) call abort() + select type(u); class is(t2) + if(u%i.ne.2) call abort() + select type(u); class is(t3) + if(u%x.ne.3.5) call abort() + end select + end select + end subroutine s +end module m + +program p + use m + implicit none + type(t3) :: var = t3( l=.true. , i=2 , x=3.5 ) + call s(var) +end program p