Question on variable_size and function-at-a-time
Geoff Keating
geoffk@desire.geoffk.org
Thu Apr 15 10:55:00 GMT 2004
> X-Original-To: geoffk@foam.wonderslug.com
> Date: Wed, 14 Apr 2004 22:27:08 +0200
> From: Toon Moene <toon@moene.indiv.nluug.nl>
> Organization: Moene Computational Physics, Maartensdijk, NL
> X-Accept-Language: en
> Cc: Geoff Keating <geoffk@geoffk.org>, Richard Henderson <rth@redhat.com>,
> Richard Kenner <kenner@vlsi1.ultra.nyu.edu>, gcc@gcc.gnu.org
> X-OriginalArrivalTime: 14 Apr 2004 20:22:51.0968 (UTC) FILETIME=[4301D400:01C4225E]
>
> Robert Dewar wrote:
>
> > Geoff Keating wrote:
> >
> >> I believe it's wrong that we use SAVE_EXPR for array sizes for C. We
> >> should instead create temporary variables to hold the size
> >> declarations, and set them in the appropriate point in the instruction
> >> stream.
> >
> > I agree. In fact my feeling is that we should get rid of the use
> > of SAVE_EXPR wherever possible.
>
> That's OK with me, as long as we have a way of expressing that in
>
> SUBROUTINE SUB(A, N)
> DIMENSION A(N)
> N = N + 1
> DO I = 1, N - 1
> PRINT*, A(I)
> END DO
> PRINT*, N
> END
>
> still works correctly and both
>
> 1. Prints A(1 .. original N)
> 2. Prints original N + 1 at the end.
Sure, like this (in pseudo-F77):
SUBROUTINE SUB(A, N)
ASIZE = N
DIMENSION A(ASIZE)
N = N + 1
DO I = 1, N - 1
PRINT*, A(I)
END DO
PRINT*, N
END
--
- Geoffrey Keating <geoffk@geoffk.org>
More information about the Gcc
mailing list