This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [PATCH] variable size arrays in nested functions


Richard Kenner wrote:

> For example, in Ada you can have an array whose array bounds are given
> by function calls.  It's semantically required that those bounds be
> evaluated exactly once and also when they are evaluated.  Sure, you can
> use variables for the bounds, but SAVE_EXPR is just a shorthand for that
> and avoids the scoping issues inherent with such variables.

AFAICan remember, this exactly is the way the Fortran Frontend uses
SAVE_EXPR.

Example code:

      DIMENSION A(10)
      DATA A/10*2./
      I = 10
      CALL AAP(I, A)
      END
      SUBROUTINE AAP(N, A)
      DIMENSION A(N)
      N = N + 1			! Note this :-)
      PRINT*,(A(I), I=1,N-1)
      PRINT*,A
      END

This should work [ expletives deleted ] ;-)

Success <heh> <heh> ...

-- 
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]