[Bug fortran/43696] [OOP] Bogus error: Passed-object dummy argument must not be POINTER
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43696 janus at gcc dot gnu.org changed: What|Removed |Added Target Milestone|--- |4.6.0
[Bug fortran/43696] [OOP] Bogus error: Passed-object dummy argument must not be POINTER
--- 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=gccview=revrev=159056 Log: 2010-05-05 Janus Weil ja...@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 ja...@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
[Bug fortran/43696] [OOP] Bogus error: Passed-object dummy argument must not be POINTER
--- 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
[Bug fortran/43696] [OOP] Bogus error: Passed-object dummy argument must not be POINTER
--- 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|-00-00 00:00:00 |2010-05-03 20:03:44 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43696
[Bug fortran/43696] [OOP] Bogus error: Passed-object dummy argument must not be POINTER
--- 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
[Bug fortran/43696] [OOP] Bogus error: Passed-object dummy argument must not be POINTER
--- 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
[Bug fortran/43696] [OOP] Bogus error: Passed-object dummy argument must not be POINTER
--- 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
[Bug fortran/43696] [OOP] Bogus error: Passed-object dummy argument must not be POINTER
--- 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
[Bug fortran/43696] [OOP] Bogus error: Passed-object dummy argument must not be POINTER
--- 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