public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/66493] New: ICE on alternate return argument for typebound procedure
@ 2015-06-10 16:21 gerhard.steinmetz.fortran@t-online.de
2015-06-10 21:18 ` [Bug fortran/66493] " dominiq at lps dot ens.fr
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-06-10 16:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66493
Bug ID: 66493
Summary: ICE on alternate return argument for typebound
procedure
Product: gcc
Version: 5.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: gerhard.steinmetz.fortran@t-online.de
Target Milestone: ---
This code with an alternate return argument (*) seems to be improper :
module p
type t
contains
procedure :: s
end type
contains
subroutine s(*)
end
end module
and yields (with gfortran 5.1.1 on SUSE Linux 13.2, 64 bit) :
f951: internal compiler error: in resolve_typebound_procedure, at
fortran/resolve.c:12210
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/66493] ICE on alternate return argument for typebound procedure
2015-06-10 16:21 [Bug fortran/66493] New: ICE on alternate return argument for typebound procedure gerhard.steinmetz.fortran@t-online.de
@ 2015-06-10 21:18 ` dominiq at lps dot ens.fr
2015-06-10 22:21 ` kargl at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens.fr @ 2015-06-10 21:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66493
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-06-10
Ever confirmed|0 |1
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Confirmed from 4.6 up to trunk (6.0).
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/66493] ICE on alternate return argument for typebound procedure
2015-06-10 16:21 [Bug fortran/66493] New: ICE on alternate return argument for typebound procedure gerhard.steinmetz.fortran@t-online.de
2015-06-10 21:18 ` [Bug fortran/66493] " dominiq at lps dot ens.fr
@ 2015-06-10 22:21 ` kargl at gcc dot gnu.org
2015-06-11 0:04 ` kargl at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-06-10 22:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66493
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
Assignee|unassigned at gcc dot gnu.org |kargl at gcc dot gnu.org
--- Comment #2 from kargl at gcc dot gnu.org ---
I have a patch. Just need to come up with a complete test.
With my patch the following runs to completion:
program foo
integer :: cnt = 0
1 call bar(*10, *20)
cnt = cnt + 1
goto 30
10 cnt = cnt + 1
if (cnt /= 3) call abort
stop
20 cnt = cnt + 1
30 goto 1
end program foo
subroutine bar(*, *)
implicit none
integer, save :: i = 0
if (i < 0) return 1
if (i > 0) then
i = -i
return 2
end if
i = i + 1
end subroutine bar
Having never used type bound procedure, it may take a bit to convert this
into a testcase.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/66493] ICE on alternate return argument for typebound procedure
2015-06-10 16:21 [Bug fortran/66493] New: ICE on alternate return argument for typebound procedure gerhard.steinmetz.fortran@t-online.de
2015-06-10 21:18 ` [Bug fortran/66493] " dominiq at lps dot ens.fr
2015-06-10 22:21 ` kargl at gcc dot gnu.org
@ 2015-06-11 0:04 ` kargl at gcc dot gnu.org
2015-06-11 0:04 ` kargl at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-06-11 0:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66493
--- Comment #3 from kargl at gcc dot gnu.org ---
Created attachment 35748
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35748&action=edit
test program without type bound procedure
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/66493] ICE on alternate return argument for typebound procedure
2015-06-10 16:21 [Bug fortran/66493] New: ICE on alternate return argument for typebound procedure gerhard.steinmetz.fortran@t-online.de
` (2 preceding siblings ...)
2015-06-11 0:04 ` kargl at gcc dot gnu.org
@ 2015-06-11 0:04 ` kargl at gcc dot gnu.org
2015-06-11 0:05 ` kargl at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-06-11 0:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66493
--- Comment #4 from kargl at gcc dot gnu.org ---
Created attachment 35749
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35749&action=edit
test program with tbp
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/66493] ICE on alternate return argument for typebound procedure
2015-06-10 16:21 [Bug fortran/66493] New: ICE on alternate return argument for typebound procedure gerhard.steinmetz.fortran@t-online.de
` (3 preceding siblings ...)
2015-06-11 0:04 ` kargl at gcc dot gnu.org
@ 2015-06-11 0:05 ` kargl at gcc dot gnu.org
2015-06-11 0:10 ` kargl at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-06-11 0:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66493
--- Comment #5 from kargl at gcc dot gnu.org ---
Created attachment 35750
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35750&action=edit
Patch that gets rid of ICE
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/66493] ICE on alternate return argument for typebound procedure
2015-06-10 16:21 [Bug fortran/66493] New: ICE on alternate return argument for typebound procedure gerhard.steinmetz.fortran@t-online.de
` (4 preceding siblings ...)
2015-06-11 0:05 ` kargl at gcc dot gnu.org
@ 2015-06-11 0:10 ` kargl at gcc dot gnu.org
2015-06-11 8:05 ` gerhard.steinmetz.fortran@t-online.de
2015-06-11 8:22 ` gerhard.steinmetz.fortran@t-online.de
7 siblings, 0 replies; 9+ messages in thread
From: kargl at gcc dot gnu.org @ 2015-06-11 0:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66493
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|kargl at gcc dot gnu.org |unassigned at gcc dot gnu.org
--- Comment #6 from kargl at gcc dot gnu.org ---
Some who understands the internals of type bound procedures will need to
expand my patch. The patch cures the ICE in comment #1. I've attached
two test programs. The 1st one does not use TBP. The 2nd one does. I
get
gfc6 -o z gfc6 -o z alternate_return_2.f90 && ./z
alternate_return_2.f90:30:17:
call argh%bar(*10, *20)
1
Error: Syntax error in argument list at (1)
The reason is that whoever write the TBP code did not consider
the possibility of alternate return. I don't blame them. I
simply don't know how to fix it.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/66493] ICE on alternate return argument for typebound procedure
2015-06-10 16:21 [Bug fortran/66493] New: ICE on alternate return argument for typebound procedure gerhard.steinmetz.fortran@t-online.de
` (5 preceding siblings ...)
2015-06-11 0:10 ` kargl at gcc dot gnu.org
@ 2015-06-11 8:05 ` gerhard.steinmetz.fortran@t-online.de
2015-06-11 8:22 ` gerhard.steinmetz.fortran@t-online.de
7 siblings, 0 replies; 9+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-06-11 8:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66493
--- Comment #7 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---
Interestingly, there are some tests in the test suite already,
especially altreturn_3.f90 and altreturn_8.f90.
The latter is using a nopass attribute and compiles.
It still should be tested with some real runtime tests, as yours.
Some of the following constructed tests fail to compile.
$ cat zarc1_1.f90
module m
implicit none
type t
contains
procedure :: s1
procedure :: s2
generic :: s => s1, s2
end type
contains
subroutine s1(*)
end
subroutine s2(*, *)
end
end module
$ cat zarc1_2_pass.f90
module m
implicit none
type t
contains
procedure, pass :: s1
procedure, pass :: s2
generic :: s => s1, s2
end type
contains
subroutine s1(*)
end
subroutine s2(*, *)
end
end module
$ cat zarc1_3_nopass.f90
module m
implicit none
type t
contains
procedure, nopass :: s1
procedure, nopass :: s2
generic :: s => s1, s2
end type
contains
subroutine s1(*)
end
subroutine s2(*, *)
end
end module
$ cat zarcg_1.f90
module m
implicit none
type t
contains
procedure :: s1
procedure :: s2
procedure :: s3
generic :: s => s1, s2, s3
end type
contains
subroutine s1(x)
class(t) :: x
end
subroutine s2(x, *)
class(t) :: x
end
subroutine s3(x, *, *)
class(t) :: x
end
end module
$ cat zarcg_2_pass.f90
module m
implicit none
type t
contains
procedure, pass :: s1
procedure, pass :: s2
procedure, pass :: s3
generic :: s => s1, s2, s3
end type
contains
subroutine s1(x)
class(t) :: x
end
subroutine s2(x, *)
class(t) :: x
end
subroutine s3(x, *, *)
class(t) :: x
end
end module
$ cat zarcg_3_nopass.f90
module m
implicit none
type t
contains
procedure, nopass :: s1
procedure, nopass :: s2
procedure, nopass :: s3
generic :: s => s1, s2, s3
end type
contains
subroutine s1(x)
class(t) :: x
end
subroutine s2(x, *)
class(t) :: x
end
subroutine s3(x, *, *)
class(t) :: x
end
end module
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/66493] ICE on alternate return argument for typebound procedure
2015-06-10 16:21 [Bug fortran/66493] New: ICE on alternate return argument for typebound procedure gerhard.steinmetz.fortran@t-online.de
` (6 preceding siblings ...)
2015-06-11 8:05 ` gerhard.steinmetz.fortran@t-online.de
@ 2015-06-11 8:22 ` gerhard.steinmetz.fortran@t-online.de
7 siblings, 0 replies; 9+ messages in thread
From: gerhard.steinmetz.fortran@t-online.de @ 2015-06-11 8:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66493
--- Comment #8 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---
Case zarc1_2_pass.f90 should be definitely illegal code.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2015-06-11 8:22 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-10 16:21 [Bug fortran/66493] New: ICE on alternate return argument for typebound procedure gerhard.steinmetz.fortran@t-online.de
2015-06-10 21:18 ` [Bug fortran/66493] " dominiq at lps dot ens.fr
2015-06-10 22:21 ` kargl at gcc dot gnu.org
2015-06-11 0:04 ` kargl at gcc dot gnu.org
2015-06-11 0:04 ` kargl at gcc dot gnu.org
2015-06-11 0:05 ` kargl at gcc dot gnu.org
2015-06-11 0:10 ` kargl at gcc dot gnu.org
2015-06-11 8:05 ` gerhard.steinmetz.fortran@t-online.de
2015-06-11 8:22 ` gerhard.steinmetz.fortran@t-online.de
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).