From: Salvatore on
Hello,
The simple file attached sends one compiler into an ICE, while it
compiles fine on another. Specifically, it is the USE A_MOD that
brings in indirectly the two type extensions together. If I comment
the last three lines (i.e. the MODULE T stuff) it compiles fine.
I don't see anything illegal here; any kind expert can confirm this?
Thanks a lot in advance
Salvatore
------------------ tt.f03 --------------------------
module base_mod
type base_type
integer :: i
contains
procedure, pass(a) :: geti
end type base_type
contains
subroutine geti(a,i)
class(base_type) :: a
integer :: i

i = a%i
end subroutine geti
end module base_mod

module s_mod
use base_mod
type, extends(base_type) :: s_type
real(kind(1.e0)) :: r
contains
procedure, pass(a) :: getr => s_getr
end type s_type

contains
subroutine s_getr(a,r)
class(s_type) :: a
real(kind(1.e0)) :: r

r = a%r
end subroutine s_getr
end module s_mod

module d_mod
use base_mod
type, extends(base_type) :: d_type
real(kind(1.d0)) :: r
contains
procedure, pass(a) :: getr => d_getr
end type d_type

contains
subroutine d_getr(a,r)
class(d_type) :: a
real(kind(1.d0)) :: r

r = a%r
end subroutine d_getr
end module d_mod

module a_mod
use s_mod
use d_mod
end module a_mod

module t
use a_mod
end module t
From: Janus Weil on
Hi Salvatore,

> The simple file attached  sends one compiler into an ICE, while it
> compiles fine on another.

could you tell us which compiler you're talking about? It seems
gfortran and ifort compile it just fine.


> Specifically, it is the USE A_MOD that
> brings in indirectly the two type extensions together. If I comment
> the last three lines (i.e. the MODULE T stuff) it compiles fine.

That smells like a compiler bug if you ask me.


> I don't see anything illegal here; any kind expert can confirm this?

Not being too much of an expert, and not having stared at your code
too hard yet, I don't see anything illegal right away.


Cheers,
Janus
From: Salvatore on
On 23 Mar, 14:04, Janus Weil <jaydu...(a)googlemail.com> wrote:
> Hi Salvatore,
>
> > The simple file attached  sends one compiler into an ICE, while it
> > compiles fine on another.
>
> could you tell us which compiler you're talking about? It seems
> gfortran and ifort compile it just fine.
>
NAG too compiles fine.
> > Specifically, it is the USE A_MOD that
> > brings in indirectly the two type extensions together. If I comment
> > the last three lines (i.e. the MODULE T stuff) it compiles fine.
>
> That smells like a compiler bug if you ask me.
>
Yes, but borrowing the terminology of gcc bugzilla, is it ICE-on-valid
or ICE-on-invalid?
I think the first.

Salvatore
From: Paul Thomas on
On Mar 23, 12:05 pm, Salvatore <sfilipp...(a)uniroma2.it> wrote:
> Hello,
> The simple file attached  sends one compiler into an ICE, while it
> compiles fine on another. Specifically, it is the USE A_MOD that
> brings in indirectly the two type extensions together. If I comment
> the last three lines (i.e. the MODULE T stuff) it compiles fine.
> I don't see anything illegal here; any kind expert can confirm this?
> Thanks a lot in advance
> Salvatore

Hi Salvatore,

Regardless of the correctness, if a compiler ICEs it is always a
bug :-)

Having just tested it on gfortran, I conclude that we either have a
regression or that it is the one that lets it through.

Your testcase looks to be compliant with the standard to me. If the
derived types were ambiguous in any way, gfortran would, of course,
complain.

Ciao

Paul
From: Salvatore on
On 23 Mar, 16:47, Paul Thomas <paul.richard.tho...(a)gmail.com> wrote:
> On Mar 23, 12:05 pm, Salvatore <sfilipp...(a)uniroma2.it> wrote:
>
> > Hello,
> > The simple file attached  sends one compiler into an ICE, while it
> > compiles fine on another. Specifically, it is the USE A_MOD that
> > brings in indirectly the two type extensions together. If I comment
> > the last three lines (i.e. the MODULE T stuff) it compiles fine.
> > I don't see anything illegal here; any kind expert can confirm this?
> > Thanks a lot in advance
> > Salvatore
>
> Hi Salvatore,
>
> Regardless of the correctness, if a compiler ICEs it is always a
> bug :-)
>
Yes, yes. The compiler in question is XLF V12.
This should be fixed with XLF 13, however I don't have access to it
(now).
Given that an ICE is an ICE, my point is that if the code is valid I
can complain louder, if it is invalid I also need to fix my code.
I think it is valid, because I can see no reason why an additional USE
layer should change the compliance...

Cheers
Salvatore