public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/43696] New: [OOP] Bogus error: Passed-object dummy argument must not be POINTER
@ 2010-04-08 21:06 janus at gcc dot gnu dot org
2010-04-08 21:11 ` [Bug fortran/43696] " janus at gcc dot gnu dot org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-04-08 21:06 UTC (permalink / raw)
To: gcc-bugs
Consider the following (supposedly valid) code:
MODULE error_stack_module
implicit none
type,abstract::serializable_class
contains
procedure(ser_DTV_RF),deferred::read_formatted
end type serializable_class
abstract interface
subroutine ser_DTV_RF(dtv,unit,iotype,v_list,iostat,iomsg)
import serializable_class
CLASS(serializable_class),INTENT(INOUT) :: dtv
INTEGER, INTENT(IN) :: unit
CHARACTER (LEN=*), INTENT(IN) :: iotype
INTEGER, INTENT(IN) :: v_list(:)
INTEGER, INTENT(OUT) :: iostat
CHARACTER (LEN=*), INTENT(INOUT) :: iomsg
end subroutine ser_DTV_RF
end interface
type,extends(serializable_class)::error_type
class(error_type),pointer::next=>null()
contains
procedure::read_formatted=>error_read_formatted
end type error_type
contains
recursive subroutine
error_read_formatted(dtv,unit,iotype,v_list,iostat,iomsg)
CLASS(error_type),INTENT(INOUT) :: dtv
INTEGER, INTENT(IN) :: unit
CHARACTER (LEN=*), INTENT(IN) :: iotype
INTEGER, INTENT(IN) :: v_list(:)
INTEGER, INTENT(OUT) :: iostat
CHARACTER (LEN=*), INTENT(INOUT) :: iomsg
character(8),allocatable::type
character(8),allocatable::next
call basic_read_string(unit,type)
call basic_read_string(unit,next)
if(next=="NEXT")then
allocate(dtv%next)
call dtv%next%read_formatted(unit,iotype,v_list,iostat,iomsg)
end if
end subroutine error_read_formatted
end MODULE error_stack_module
With current trunk, compilation results in:
error_stack.f03:25.14:
procedure::read_formatted=>error_read_formatted
1
Error: Passed-object dummy argument of 'error_read_formatted' at (1) must not
be POINTER
error_stack.f03:22.46:
type,extends(serializable_class)::error_type
1
Error: Derived-type 'error_type' declared at (1) must be ABSTRACT because
'read_formatted' is DEFERRED and not overridden
f951: internal compiler error: in resolve_class_esym, at fortran/resolve.c:5255
The first error message is apparently bogus, the second one seems to be a
consequence of the first one. The ICE may be a separate issue.
--
Summary: [OOP] Bogus error: Passed-object dummy argument must not
be POINTER
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: janus at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43696
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/43696] [OOP] Bogus error: Passed-object dummy argument must not be POINTER
2010-04-08 21:06 [Bug fortran/43696] New: [OOP] Bogus error: Passed-object dummy argument must not be POINTER janus at gcc dot gnu dot org
@ 2010-04-08 21:11 ` janus at gcc dot gnu dot org
2010-04-08 21:24 ` dominiq at lps dot ens dot fr
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-04-08 21:11 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from janus at gcc dot gnu dot org 2010-04-08 21:11 -------
Forgot to mention: This one was reported by Hans-Werner Boschmann (thanks!).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43696
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/43696] [OOP] Bogus error: Passed-object dummy argument must not be POINTER
2010-04-08 21:06 [Bug fortran/43696] New: [OOP] Bogus error: Passed-object dummy argument must not be POINTER janus at gcc dot gnu dot org
2010-04-08 21:11 ` [Bug fortran/43696] " janus at gcc dot gnu dot org
@ 2010-04-08 21:24 ` dominiq at lps dot ens dot fr
2010-04-09 8:42 ` burnus at gcc dot gnu dot org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: dominiq at lps dot ens dot fr @ 2010-04-08 21:24 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from dominiq at lps dot ens dot fr 2010-04-08 21:24 -------
Note there is no ICE with fortran-dev.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43696
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/43696] [OOP] Bogus error: Passed-object dummy argument must not be POINTER
2010-04-08 21:06 [Bug fortran/43696] New: [OOP] Bogus error: Passed-object dummy argument must not be POINTER janus at gcc dot gnu dot org
2010-04-08 21:11 ` [Bug fortran/43696] " janus at gcc dot gnu dot org
2010-04-08 21:24 ` dominiq at lps dot ens dot fr
@ 2010-04-09 8:42 ` burnus at gcc dot gnu dot org
2010-04-09 15:22 ` boschmann at tp1 dot physik dot uni-siegen dot de
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: burnus at gcc dot gnu dot org @ 2010-04-09 8:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from burnus at gcc dot gnu dot org 2010-04-09 08:42 -------
(In reply to comment #0)
> Error: Passed-object dummy argument of 'error_read_formatted' at (1) must not
> be POINTER
The error message itself is OK as the constraint is (F2008 FDIS):
"C456 The passed-object dummy argument shall be a scalar, nonpointer,
nonallocatable dummy data object with the same declared type as the type being
defined; all of its length type parameters shall be assumed; it shall be
polymorphic (4.3.1.3) if and only if the type being defined is extensible
(4.5.7). It shall not have the VALUE attribute."
However, if one looks at the object:
type,extends(serializable_class)::error_type
[...]
contains
procedure :: read_formatted => error_read_formatted
[...]
recursive subroutine
error_read_formatted(dtv,unit,iotype,v_list,iostat,iomsg)
CLASS(error_type),INTENT(INOUT) :: dtv
The constraint seems to be fulfilled:
"dtv" is a scalar, nonpointer, nonallocatable dummy. It does not have any
length type parameters and it is not VALUE. And its type (well, class) is
"error_type" as the type in which is it used - and CLASS is allows because
"error_type" is extensible.
The check itself in resolve.c also looks OK:
me_arg->ts.u.derived->components->attr.class_pointer
but it seems as if either the first component is checked (which would be is
wrong) or as if the wrong type is used. One has:
type,extends(serializable_class)::error_type
class(error_type),pointer::next=>null()
The component is polymorphic and of the same type and it is a POINTER; I assume
that is the cause of the trouble.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43696
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/43696] [OOP] Bogus error: Passed-object dummy argument must not be POINTER
2010-04-08 21:06 [Bug fortran/43696] New: [OOP] Bogus error: Passed-object dummy argument must not be POINTER janus at gcc dot gnu dot org
` (2 preceding siblings ...)
2010-04-09 8:42 ` burnus at gcc dot gnu dot org
@ 2010-04-09 15:22 ` boschmann at tp1 dot physik dot uni-siegen dot de
2010-04-12 9:50 ` janus at gcc dot gnu dot org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: boschmann at tp1 dot physik dot uni-siegen dot de @ 2010-04-09 15:22 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from boschmann at tp1 dot physik dot uni-siegen dot de 2010-04-09 15:22 -------
I've tried to isolate the error message from the ICE. The smallest code is
a_module for the error and b_module for the ICE. a_module is valid f2003 code
but b_module is not, it contains a pointer of undefined class. I guess that
this case occurs when error_stack_module is compiled: error_type will not be
defined in consequence of the "must not be POINTER" error but will be used as
class later.
module a_module
implicit none
type::a_type
class(a_type),pointer::a_component
contains
procedure::proc=>a_proc
end type a_type
contains
subroutine a_proc(this)
class(a_type)::this
end subroutine a_proc
end module a_module
!!$ > gfortran -c a.f03
!!$ a.f03:6.14:
!!$
!!$ procedure::proc=>a_proc
!!$ 1
!!$ Error: Passed-object dummy argument of 'a_proc' at (1) must not be POINTER
module b_module
implicit none
type::b_type
class(not_yet_defined_type_type),pointer::b_component
end type b_type
end module b_module
!!$ > gfortran -c b.f03
!!$ f951: internal compiler error: in find_typebound_proc_uop, at
fortran/symbol.c:4863
!!$ Please submit a full bug report,
!!$ with preprocessed source if appropriate.
!!$ See <http://gcc.gnu.org/bugs.html> for instructions.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43696
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/43696] [OOP] Bogus error: Passed-object dummy argument must not be POINTER
2010-04-08 21:06 [Bug fortran/43696] New: [OOP] Bogus error: Passed-object dummy argument must not be POINTER janus at gcc dot gnu dot org
` (3 preceding siblings ...)
2010-04-09 15:22 ` boschmann at tp1 dot physik dot uni-siegen dot de
@ 2010-04-12 9:50 ` janus at gcc dot gnu dot org
2010-05-03 20:04 ` janus at gcc dot gnu dot org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-04-12 9:50 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from janus at gcc dot gnu dot org 2010-04-12 09:50 -------
(In reply to comment #4)
> I've tried to isolate the error message from the ICE. The smallest code is
> a_module for the error and b_module for the ICE.
Thanks. However, ...
> !!$ f951: internal compiler error: in find_typebound_proc_uop, at
> fortran/symbol.c:4863
this ICE seems to be different from the one in comment #0.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43696
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/43696] [OOP] Bogus error: Passed-object dummy argument must not be POINTER
2010-04-08 21:06 [Bug fortran/43696] New: [OOP] Bogus error: Passed-object dummy argument must not be POINTER janus at gcc dot gnu dot org
` (4 preceding siblings ...)
2010-04-12 9:50 ` janus at gcc dot gnu dot org
@ 2010-05-03 20:04 ` janus at gcc dot gnu dot org
2010-05-05 7:45 ` janus at gcc dot gnu dot org
2010-05-05 8:13 ` janus at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-05-03 20:04 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from janus at gcc dot gnu dot org 2010-05-03 20:03 -------
Mine. I think fixing comment #0 is as easy as the following two-liner:
Index: gcc/fortran/symbol.c
===================================================================
--- gcc/fortran/symbol.c (revision 158970)
+++ gcc/fortran/symbol.c (working copy)
@@ -4720,6 +4720,8 @@ gfc_build_class_symbol (gfc_typespec *ts, symbol_a
sprintf (name, ".class.%s.%d.a", ts->u.derived->name, (*as)->rank);
else if ((*as) && (*as)->rank)
sprintf (name, ".class.%s.%d", ts->u.derived->name, (*as)->rank);
+ else if (attr->pointer)
+ sprintf (name, ".class.%s.p", ts->u.derived->name);
else if (attr->allocatable)
sprintf (name, ".class.%s.a", ts->u.derived->name);
else
Apparently this doesn't even induce any testsuite regressions. However, the ICE
in comment #4 will need some additional care.
Btw, the ICE in comment #0 is gone already since fortran-dev has been merged to
trunk.
--
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|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2010-05-03 20:03:44
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43696
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/43696] [OOP] Bogus error: Passed-object dummy argument must not be POINTER
2010-04-08 21:06 [Bug fortran/43696] New: [OOP] Bogus error: Passed-object dummy argument must not be POINTER janus at gcc dot gnu dot org
` (5 preceding siblings ...)
2010-05-03 20:04 ` janus at gcc dot gnu dot org
@ 2010-05-05 7:45 ` janus at gcc dot gnu dot org
2010-05-05 8:13 ` janus at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-05-05 7:45 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from janus at gcc dot gnu dot org 2010-05-05 07:45 -------
Subject: Bug 43696
Author: janus
Date: Wed May 5 07:44:33 2010
New Revision: 159056
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159056
Log:
2010-05-05 Janus Weil <janus@gcc.gnu.org>
PR fortran/43696
* resolve.c (resolve_fl_derived): Some fixes for class variables.
* symbol.c (gfc_build_class_symbol): Add separate class container for
class pointers.
2010-05-05 Janus Weil <janus@gcc.gnu.org>
PR fortran/43696
* gfortran.dg/class_17.f03: New.
Added:
trunk/gcc/testsuite/gfortran.dg/class_17.f03
Modified:
trunk/gcc/fortran/ChangeLog
trunk/gcc/fortran/resolve.c
trunk/gcc/fortran/symbol.c
trunk/gcc/testsuite/ChangeLog
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43696
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug fortran/43696] [OOP] Bogus error: Passed-object dummy argument must not be POINTER
2010-04-08 21:06 [Bug fortran/43696] New: [OOP] Bogus error: Passed-object dummy argument must not be POINTER janus at gcc dot gnu dot org
` (6 preceding siblings ...)
2010-05-05 7:45 ` janus at gcc dot gnu dot org
@ 2010-05-05 8:13 ` janus at gcc dot gnu dot org
7 siblings, 0 replies; 9+ messages in thread
From: janus at gcc dot gnu dot org @ 2010-05-05 8:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from janus at gcc dot gnu dot org 2010-05-05 08:13 -------
Fixed with r159056. Closing.
--
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=43696
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-05-05 8:13 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-08 21:06 [Bug fortran/43696] New: [OOP] Bogus error: Passed-object dummy argument must not be POINTER janus at gcc dot gnu dot org
2010-04-08 21:11 ` [Bug fortran/43696] " janus at gcc dot gnu dot org
2010-04-08 21:24 ` dominiq at lps dot ens dot fr
2010-04-09 8:42 ` burnus at gcc dot gnu dot org
2010-04-09 15:22 ` boschmann at tp1 dot physik dot uni-siegen dot de
2010-04-12 9:50 ` janus at gcc dot gnu dot org
2010-05-03 20:04 ` janus at gcc dot gnu dot org
2010-05-05 7:45 ` janus at gcc dot gnu dot org
2010-05-05 8:13 ` 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).