For Programmers: Free Programming Magazines  


Home > Archive > Fortran > January 2006 > limit on nesting of loops









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author limit on nesting of loops
beliavsky@aol.com

2006-01-27, 7:01 pm

Does the Fortran standard require that compilers handle loops up to a
certain level of nesting?
I would guess that some compilers allow deeper nesting than the
minimum. What are typical limits for compilers? I am especially
interested in g95 and LF95. I Googled a little and did not find the
answer.

Richard E Maine

2006-01-27, 7:01 pm

<beliavsky@aol.com> wrote:

> Does the Fortran standard require that compilers handle loops up to a
> certain level of nesting?


No. In fact, that is one of the classic examples of item (5) in section
1.4 (Exclusions).

"This standard does not specify...
(5) The size or complexity of a program and its data that will
exceeed the capacity of any particular computing system
or capability of a particular processor,"

and recall here that "processor" in standard-speak doesn't mean CPU; it
includes the compiler. Limits on DO nesting are one of the most commonly
used examples of this clause in textbooks.

--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain| experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
Joost

2006-01-27, 7:01 pm

Just testing g95, I find that it executes properly 30 nested loops. It
also compiles 40 nested loops without problems, but takes longer to
test, so I haven't done that. I don't expect there is a limit,
actually.

Joost

Steven G. Kargl

2006-01-27, 7:01 pm

In article <1138392354.626913.221820@g43g2000cwa.googlegroups.com>,
"Joost" <jv244@cam.ac.uk> writes:
> Just testing g95, I find that it executes properly 30 nested loops. It
> also compiles 40 nested loops without problems, but takes longer to
> test, so I haven't done that. I don't expect there is a limit,
> actually.


For do loops that use statement labels, the limit is probably
99999. No, I haven't tried to compile such a program.

--
Steve
http://troutmask.apl.washington.edu/~kargl/
Ken Plotkin

2006-01-27, 7:01 pm

On Fri, 27 Jan 2006 23:11:53 +0000 (UTC),
kargl@troutmask.apl.washington.edu (Steven G. Kargl) wrote:


>For do loops that use statement labels, the limit is probably
>99999. No, I haven't tried to compile such a program.


Nested DO loops can share the same target, so it's still unlimited.
Steven G. Kargl

2006-01-27, 7:01 pm

In article <qjclt1lt8nl9dm87l0g5v0cf8m97e3smjb@4ax.com>,
Ken Plotkin <kplotkin@nospam-cox.net> writes:
> On Fri, 27 Jan 2006 23:11:53 +0000 (UTC),
> kargl@troutmask.apl.washington.edu (Steven G. Kargl) wrote:
>
>
>
> Nested DO loops can share the same target, so it's still unlimited.


Yes, you are correct!

--
Steve
http://troutmask.apl.washington.edu/~kargl/
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com