public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug fortran/46161] New: [OOP] Invalid: Passing non-polymorphic to allocatable polymorphic dummy
@ 2010-10-24 22:28 burnus at gcc dot gnu.org
2010-10-26 13:04 ` [Bug fortran/46161] " janus at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: burnus at gcc dot gnu.org @ 2010-10-24 22:28 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46161
Summary: [OOP] Invalid: Passing non-polymorphic to allocatable
polymorphic dummy
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: accepts-invalid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
Follow up to PR 45451 comment 14. The following is not detected:
Passing a non-polymorphic actual argument ("type(foo), allocatable") to an
allocatable polymorphic dummy ("class(foo), allocatable").
>From Fortran 2008: "12.5.2.5 Allocatable and pointer dummy variables"
"The actual argument shall be polymorphic if and only if the associated dummy
argument is polymorphic, and either both the actual and dummy arguments shall
be unlimited polymorphic, or the declared type of the actual argument shall be
the same as the declared type of the dummy argument."
Test case: attachment 21613 of PR 45451. Crayftn rejects the example with the
following error message - gfortran prints no error:
call doit(atx,acsr)
^
ftn-1872 crayftn: ERROR BUG23, File = long2.f90, Line = 304, Column = 17
Dummy argument "ACSR" is a polymorphic ALLOCATABLE. It requires a
polymorphic ALLOCATABLE actual argument.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/46161] [OOP] Invalid: Passing non-polymorphic to allocatable polymorphic dummy 2010-10-24 22:28 [Bug fortran/46161] New: [OOP] Invalid: Passing non-polymorphic to allocatable polymorphic dummy burnus at gcc dot gnu.org @ 2010-10-26 13:04 ` janus at gcc dot gnu.org 2010-10-27 21:42 ` janus at gcc dot gnu.org 2010-10-27 21:42 ` janus at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: janus at gcc dot gnu.org @ 2010-10-26 13:04 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46161 janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2010.10.26 13:04:05 AssignedTo|unassigned at gcc dot |janus at gcc dot gnu.org |gnu.org | Ever Confirmed|0 |1 --- Comment #1 from janus at gcc dot gnu.org 2010-10-26 13:04:05 UTC --- Preliminary patch: Index: gcc/fortran/interface.c =================================================================== --- gcc/fortran/interface.c (revision 165936) +++ gcc/fortran/interface.c (working copy) @@ -1519,6 +1520,18 @@ compare_parameter (gfc_symbol *formal, gfc_expr *a gfc_typename (&formal->ts)); return 0; } + + /* F2003, 12.5.2.5. */ + if (formal->ts.type == BT_CLASS + && (CLASS_DATA (formal)->attr.pointer + || CLASS_DATA (formal)->attr.allocatable) + && actual->ts.type != BT_CLASS) + { + if (where) + gfc_error ("Actual argument to '%s' at %L must be polymorphic", + formal->name, &actual->where); + return 0; + } if (formal->attr.codimension) { ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/46161] [OOP] Invalid: Passing non-polymorphic to allocatable polymorphic dummy 2010-10-24 22:28 [Bug fortran/46161] New: [OOP] Invalid: Passing non-polymorphic to allocatable polymorphic dummy burnus at gcc dot gnu.org 2010-10-26 13:04 ` [Bug fortran/46161] " janus at gcc dot gnu.org @ 2010-10-27 21:42 ` janus at gcc dot gnu.org 2010-10-27 21:42 ` janus at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: janus at gcc dot gnu.org @ 2010-10-27 21:42 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46161 --- Comment #2 from janus at gcc dot gnu.org 2010-10-27 21:41:56 UTC --- Author: janus Date: Wed Oct 27 21:41:52 2010 New Revision: 166018 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=166018 Log: 2010-10-27 Janus Weil <janus@gcc.gnu.org> PR fortran/46161 * interface.c (compare_allocatable): Handle polymorphic allocatables. (compare_parameter): Add two error messages for polymorphic dummies. 2010-10-27 Janus Weil <janus@gcc.gnu.org> PR fortran/46161 * gfortran.dg/class_dummy_3.f03: New. Added: trunk/gcc/testsuite/gfortran.dg/class_dummy_3.f03 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/interface.c trunk/gcc/testsuite/ChangeLog ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug fortran/46161] [OOP] Invalid: Passing non-polymorphic to allocatable polymorphic dummy 2010-10-24 22:28 [Bug fortran/46161] New: [OOP] Invalid: Passing non-polymorphic to allocatable polymorphic dummy burnus at gcc dot gnu.org 2010-10-26 13:04 ` [Bug fortran/46161] " janus at gcc dot gnu.org 2010-10-27 21:42 ` janus at gcc dot gnu.org @ 2010-10-27 21:42 ` janus at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: janus at gcc dot gnu.org @ 2010-10-27 21:42 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46161 janus at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED --- Comment #3 from janus at gcc dot gnu.org 2010-10-27 21:42:43 UTC --- Fixed with r166018. Closing. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-10-27 21:42 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2010-10-24 22:28 [Bug fortran/46161] New: [OOP] Invalid: Passing non-polymorphic to allocatable polymorphic dummy burnus at gcc dot gnu.org 2010-10-26 13:04 ` [Bug fortran/46161] " janus at gcc dot gnu.org 2010-10-27 21:42 ` janus at gcc dot gnu.org 2010-10-27 21:42 ` janus at gcc dot gnu.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).