public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/44558] New: [OOP] ICE on invalid code: called TBP subroutine as TBP function
@ 2010-06-16 15:25 boschmann at tp1 dot physik dot uni-siegen dot de
2010-06-16 20:50 ` [Bug fortran/44558] " janus at gcc dot gnu dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: boschmann at tp1 dot physik dot uni-siegen dot de @ 2010-06-16 15:25 UTC (permalink / raw)
To: gcc-bugs
module ice5
type::a_type
contains
procedure::a_subroutine_1
procedure::a_subroutine_2
end type a_type
contains
subroutine a_subroutine_1(this)
class(a_type)::this
real::res
res=this%a_subroutine_2()
end subroutine a_subroutine_1
subroutine a_subroutine_2(this)
class(a_type)::this
end subroutine a_subroutine_2
end module ice5
gfortran -c ice5.f03
ice5.f03:11.8:
res=this%a_subroutine_2()
1
Fehler: 'a_subroutine_2' at (1) should be a FUNCTION
f951: interner Compiler-Fehler: in gfc_add_component_ref, bei
fortran/class.c:77
Obvioulsly the code is nonsense and the compiler generates a proper error
message, so there is little need to fix this ICE. However, it is an ICE.
--
Summary: [OOP] ICE on invalid code: called TBP subroutine as TBP
function
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: boschmann at tp1 dot physik dot uni-siegen dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44558
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/44558] [OOP] ICE on invalid code: called TBP subroutine as TBP function
2010-06-16 15:25 [Bug fortran/44558] New: [OOP] ICE on invalid code: called TBP subroutine as TBP function boschmann at tp1 dot physik dot uni-siegen dot de
@ 2010-06-16 20:50 ` janus at gcc dot gnu dot org
2010-06-16 20:58 ` janus at gcc dot gnu dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-06-16 20:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from janus at gcc dot gnu dot org 2010-06-16 20:50 -------
Confirmed. Btw the same thing happens if you treat a type-bound function as if
it were a subroutine:
module ice5
type::a_type
contains
procedure::a_subroutine_1
procedure::a_subroutine_2
end type a_type
contains
real function a_subroutine_1(this)
class(a_type)::this
real::res
!res=this%a_subroutine_2()
end function
subroutine a_subroutine_2(this)
class(a_type)::this
call this%a_subroutine_1()
end subroutine
end module ice5
Error: 'a_subroutine_1' at (1) should be a SUBROUTINE
f951: internal compiler error: in gfc_add_component_ref, at fortran/class.c:77
--
janus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2010-06-16 20:50:20
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44558
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/44558] [OOP] ICE on invalid code: called TBP subroutine as TBP function
2010-06-16 15:25 [Bug fortran/44558] New: [OOP] ICE on invalid code: called TBP subroutine as TBP function boschmann at tp1 dot physik dot uni-siegen dot de
2010-06-16 20:50 ` [Bug fortran/44558] " janus at gcc dot gnu dot org
@ 2010-06-16 20:58 ` janus at gcc dot gnu dot org
2010-06-17 22:16 ` janus at gcc dot gnu dot org
2010-06-17 22:18 ` janus at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-06-16 20:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from janus at gcc dot gnu dot org 2010-06-16 20:58 -------
This is easily fixed by the following patch:
Index: gcc/fortran/resolve.c
===================================================================
--- gcc/fortran/resolve.c (revision 160833)
+++ gcc/fortran/resolve.c (working copy)
@@ -5498,7 +5498,8 @@ resolve_typebound_function (gfc_expr* e)
/* Treat the call as if it is a typebound procedure, in order to roll
out the correct name for the specific function. */
- resolve_compcall (e, &name);
+ if (resolve_compcall (e, &name) == FAILURE)
+ return FAILURE;
ts = e->ts;
/* Then convert the expression to a procedure pointer component call. */
@@ -5571,7 +5572,8 @@ resolve_typebound_subroutine (gfc_code *code)
if (code->expr1->value.compcall.tbp->is_generic)
genname = code->expr1->value.compcall.name;
- resolve_typebound_call (code, &name);
+ if (resolve_typebound_call (code, &name) == FAILURE)
+ return FAILURE;
ts = code->expr1->ts;
/* Then convert the expression to a procedure pointer component call. */
I will regtest this now and in case of success commit it as obvious later ...
--
janus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |janus at gcc dot gnu dot org
|dot org |
Status|NEW |ASSIGNED
Last reconfirmed|2010-06-16 20:50:20 |2010-06-16 20:58:37
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44558
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/44558] [OOP] ICE on invalid code: called TBP subroutine as TBP function
2010-06-16 15:25 [Bug fortran/44558] New: [OOP] ICE on invalid code: called TBP subroutine as TBP function boschmann at tp1 dot physik dot uni-siegen dot de
2010-06-16 20:50 ` [Bug fortran/44558] " janus at gcc dot gnu dot org
2010-06-16 20:58 ` janus at gcc dot gnu dot org
@ 2010-06-17 22:16 ` janus at gcc dot gnu dot org
2010-06-17 22:18 ` janus at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-06-17 22:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from janus at gcc dot gnu dot org 2010-06-17 22:15 -------
Subject: Bug 44558
Author: janus
Date: Thu Jun 17 22:15:30 2010
New Revision: 160948
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=160948
Log:
2010-06-17 Janus Weil <janus@gcc.gnu.org>
PR fortran/44558
* resolve.c (resolve_typebound_function,resolve_typebound_subroutine):
Return directly in case of an error.
2010-06-17 Janus Weil <janus@gcc.gnu.org>
PR fortran/44558
* gfortran.dg/typebound_call_15.f03: New.
Added:
trunk/gcc/testsuite/gfortran.dg/typebound_call_15.f03
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/resolve.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44558
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug fortran/44558] [OOP] ICE on invalid code: called TBP subroutine as TBP function
2010-06-16 15:25 [Bug fortran/44558] New: [OOP] ICE on invalid code: called TBP subroutine as TBP function boschmann at tp1 dot physik dot uni-siegen dot de
` (2 preceding siblings ...)
2010-06-17 22:16 ` janus at gcc dot gnu dot org
@ 2010-06-17 22:18 ` janus at gcc dot gnu dot org
3 siblings, 0 replies; 5+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-06-17 22:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from janus at gcc dot gnu dot org 2010-06-17 22:18 -------
Fixed with r160948. Closing.
Thanks for the report!
--
janus at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44558
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-06-17 22:18 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-16 15:25 [Bug fortran/44558] New: [OOP] ICE on invalid code: called TBP subroutine as TBP function boschmann at tp1 dot physik dot uni-siegen dot de
2010-06-16 20:50 ` [Bug fortran/44558] " janus at gcc dot gnu dot org
2010-06-16 20:58 ` janus at gcc dot gnu dot org
2010-06-17 22:16 ` janus at gcc dot gnu dot org
2010-06-17 22:18 ` janus at gcc dot gnu dot org
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).