lbound and ubound problem?

Dimitrios Mataras mataras@upatras.gr
Tue Nov 20 20:43:00 GMT 2012


Yes you are right, they do give warnings. Thanks a lot.

Regards,

Dimitris

-----Original Message-----
From: fortran-owner@gcc.gnu.org [mailto:fortran-owner@gcc.gnu.org] On Behalf
Of N.M. Maclaren
Sent: Tuesday, November 20, 2012 10:31 PM
To: Dimitrios Mataras
Cc: fortran@gcc.gnu.org
Subject: Re: lbound and ubound problem?

On Nov 20 2012, Dimitrios Mataras wrote:
>
>The following code produces an error "Error: Start expression in DO 
>loop must be a scalar" when compiled with 4.8 The error goes away if 
>you replace do i=lbound(x), ubound(x) with do i=lbound(x,1), 
>ubound(x,1) or with do i=-8, 8 The code works fine with intel or absoft 
>compilers.
>Am I missing something here? 

Yes.  Turn on warnings and all of the compilers should give you a message;
if they don't, try reporting a bug.  ubound(x) returns an array of rank one,
and that is not allowed in standard Fortran.  Intel and Absoft clearly allow
arrays of rank and size 1 as well as scalars.


Regards,
Nick Maclaren.





More information about the Fortran mailing list