(j3.2006) Should this work?

Van Snyder Van.Snyder
Fri May 9 15:37:57 EDT 2008



> I tried this little program using three compilers on Linux:
> 
> subroutine foo ( a )
>   real :: a ( :, : )
>   integer, parameter :: b = size(shape(a))
> end subroutine foo
> 
> Two were happy, one wasn't.
> 
> It seems the value given for B is not an initialization expression.
> 
> So this shouldn't work, right?

> On Fri, 2008-05-09 at 09:38 -0600, Keith Bierman wrote:
> 
> On May 9, 2008, at 7:29 AM, Jim Xia wrote:
> 
> > 
> > 
> > Right, the expression size(shape(a)) contains a dummy argument.  It
> > is a specification expression but not initialization expression even
> > though we know its declaration is rank 2 array. 
> 
> 
> But it doesn't violate any constraints ... so  a compiler is free to
> accept it ;>

Actually, I think it does violate 04-007:C711, which is indirectly a
constraint on R506.  The initialization for B violates point (8)(b)(i)
of the definition of initialization expressions in 7.1.7.

> -- 
> Keith H. Bierman   khbkhb at gmail.com      | AIM kbiermank
> 5430 Nassau Circle East                  | 
> Cherry Hills Village, CO 80113           | 303-997-2749        
> <speaking for myself*> Copyright 2008
> 
> 
> 
> 
> 
> 
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3




More information about the J3 mailing list