(j3.2006) LEN type parameter

Malcolm Cohen malcolm
Mon Dec 18 19:54:11 EST 2017


> Interesting test with very inconsistent compiler behavior:

 

Does not look interesting to me? and the compiler behaviour is not particularly inconsistent.


> program t03
> type badtype (p5)
> integer, len :: p5
> real (kind=p5) :: x ! X decl line
> integer :: y=p5 ! Y decl line
> end type badtype
> end
> 
> Compiler 1: Error for both X and Y lines
> Compiler 2: No errors
> Compiler 3: Error for Y line only
> Compiler 4: (Evidently does not support pdt yet. Every line that includes ?p5? got an error.)



So the only unusual thing there is that apparently Compiler 2 does not analyse non-module PDT type definitions until they are instantiated.  A not entirely unreasonable approach.  All the other compilers give errors.  There?s no requirement that a compiler report *all* the errors in a single program unit!

 

> We should clarify what we want.

 

We already did.  In 2004.

 

> Maybe the type definition is OK,

 

Multiple constraint violations is an unusual meaning of ?OK?.  P5 is not permitted in an initialization expression so both the X and Y lines violate those constraints.

 

Cheers,

-- 

..............Malcolm Cohen, NAG Oxford/Tokyo.

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.j3-fortran.org/pipermail/j3/attachments/20171219/cc0b071b/attachment-0001.html>



More information about the J3 mailing list