From: Jerry DeLisle <jvdelisle@charter.net>
To: gfortran <fortran@gcc.gnu.org>
Cc: gcc patches <gcc-patches@gcc.gnu.org>
Subject: [patch, fortran]
Date: Thu, 14 Jul 2016 17:47:00 -0000 [thread overview]
Message-ID: <00d16e42-f56d-992a-1a92-da85660c9cd7@charter.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 847 bytes --]
This simple patch kindly provided by Marco solves the problem.
Regression tested on x86_64-Linux, Test case provided also.
OK to commit to trunk?
Jerry
2016-07-14 Jerry DeLisle <jvdelisle@gcc.gnu.org>
Marco Restelli <mrestelli@gmail.com>
PR fortran/62125
* symbol.c (select_type_insert_tmp): Recursively call self to take care
of nested select type.
diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c
index 0ee7dec..c967f25 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;
+ }
}
[-- Attachment #2: pr62125.f90 --]
[-- Type: text/x-fortran, Size: 647 bytes --]
! { 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
next reply other threads:[~2016-07-14 17:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-14 17:47 Jerry DeLisle [this message]
2016-07-15 1:26 ` [patch, fortran] PR62125 Nested select type not accepted (rejects valid) Jerry DeLisle
2016-07-15 8:36 ` Mikael Morin
2016-07-15 19:42 ` Jerry DeLisle
-- strict thread matches above, loose matches on Subject: below --
2014-09-08 21:23 [PATCH, Fortran] Alessandro Fanfarillo
[not found] ` <540E2489.2030403@net-b.de>
2014-09-08 22:13 ` Alessandro Fanfarillo
2014-04-08 12:04 [PATCH, FORTRAN] Bernd Edlinger
2011-06-05 21:00 [patch, fortran] Thomas Koenig
2006-06-23 17:16 [Patch, fortran] Paul Thomas
2006-06-24 15:35 ` Steve Kargl
2006-06-25 7:09 ` Paul Thomas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=00d16e42-f56d-992a-1a92-da85660c9cd7@charter.net \
--to=jvdelisle@charter.net \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).