Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Why is this invalid?

10 views
Skip to first unread message

Jared Ahern

unread,
Jun 26, 2009, 4:14:53 PM6/26/09
to
Hello again,

So, why is the following code invalid? It is (properly?) rejected by
ifort 11.1, I believe because it violates C611 of the F03 FCD: "If the
rightmost part-name is of abstract type, data-ref shall be
polymorphic."

PROGRAM invalid
IMPLICIT NONE
TYPE, ABSTRACT :: foo
INTEGER :: i
END TYPE foo
TYPE, EXTENDS(foo) :: bar
INTEGER :: j
END TYPE bar
TYPE wrapper
CLASS(foo), ALLOCATABLE :: comp
END TYPE wrapper
TYPE(wrapper) :: obj
ALLOCATE(bar :: obj%comp)
END PROGRAM invalid

I can fix this by changing obj to CLASS(wrapper); but why is this
necessary? I would think that if %comp is of abstract type, then
%comp must be polymorphic, not obj. (I.e. C611 should be the
rightmost part-ref, not data-ref.) Pardon my ignorance here; any
thoughts?

Regards,
Jared

Jared Ahern

unread,
Jun 26, 2009, 4:42:22 PM6/26/09
to
> I can fix this by changing obj to CLASS(wrapper)

Well, actually, no, I can't. Disregard that claim. I think I can do
this, if I make obj allocatable and allocate it, but that gives an ICE
in ifort (reported). But it _should_ be simple to remedy... :)

Richard Maine

unread,
Jun 26, 2009, 8:29:35 PM6/26/09
to
Jared Ahern <jared...@gmail.com> wrote:

> So, why is the following code invalid? It is (properly?) rejected by
> ifort 11.1, I believe because it violates C611 of the F03 FCD: "If the
> rightmost part-name is of abstract type, data-ref shall be
> polymorphic."

[code elided]


> I would think that if %comp is of abstract type, then
> %comp must be polymorphic, not obj. (I.e. C611 should be the
> rightmost part-ref, not data-ref.) Pardon my ignorance here; any
> thoughts?

Those two conditions are identical. See the one-line para 2 paras below
C614.

"The type and type parameters, if any, of a data-ref are those of the
rightmost part name."


(And please forgive the superfluous "if any". I tried to get a lot of
those taken out as being redundant and distracting, but the committee
didn't always go along with me.)

--
Richard Maine | Good judgment comes from experience;
email: last name at domain . net | experience comes from bad judgment.
domain: summertriangle | -- Mark Twain

robert....@sun.com

unread,
Jun 26, 2009, 10:12:17 PM6/26/09
to

The code looks standard-conforming to me. As Richard Maine
notes, the type-specifier for obj%comp is CLASS(foo), which
is polymorphic.

Bob Corbett

Jared Ahern

unread,
Jun 27, 2009, 10:42:03 AM6/27/09
to
Ah, thanks to you both! I was mistaken in my understanding of the
standard; I thought that data-ref was somehow specifying the full list
of part names, or something else silly... Missed the clarification of
data-ref.

Steve Lionel

unread,
Jun 29, 2009, 11:45:53 AM6/29/09
to

I have passed this on to our development team. The issue ID is DPD200137426
--
Steve Lionel
Developer Products Division
Intel Corporation
Nashua, NH

For email address, replace "invalid" with "com"

User communities for Intel Software Development Products
http://software.intel.com/en-us/forums/
Intel Software Development Products Support
http://software.intel.com/sites/support/
My Fortran blog
http://www.intel.com/software/drfortran

0 new messages