Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

DO construct IVF vs. CVF

reidar_tyssen
Beginner
736 Views

The do construct

DO I=1,ISTOP,ISTEP

.

.

ENDDO

is expecteed to do to a number of loops given by:

MAX=(ISTOP-ISTART+STEP)/ISTEP

For the case ISTOP =0,ISTEP=1, MAX = (0-1+1)/1 = 0

In my code used to be compiled by CVF, this worked as presumed,

but with IVF the loop will be executed once. Why?

Is there any compiler switch to be set to avoid this?

Regards

Reidar

0 Kudos
4 Replies
aagaard
Beginner
736 Views
Default, should be as you expect. But there exist an compiler option to control if old F66 compability (always one pass through the loop) should be enforced.
I have copied in the compiler help.
Allan

onetrip, Qonetrip

Tells the compiler to follow the FORTRAN 66 Standard and execute DO loops at least once.

IDE Equivalent

None

Architectures

IA-32 architecture, Intel 64 architecture, IA-64 architecture

Syntax

Linux and Mac OS X: -onetrip
Windows: /Qonetrip

Arguments

None

Default

OFF The compiler applies the current Fortran Standard semantics, which allows zero-trip DO loops.

Description

This option tells the compiler to follow the FORTRAN 66 Standard and execute DO loops at least once.

Alternate Options

Linux and Mac OS X: -1
Windows: /1

0 Kudos
Steven_L_Intel1
Employee
736 Views
I would not expect this to behave differently unless, as noted, you have set the /f66 switch.
0 Kudos
TimP
Honored Contributor III
736 Views
If you have an example where the current compiler doesn't follow the standard, please file a bug report. As the previous answer pointed out, the options -1 -onetrip are intended to over-ride the standard.
Minor quibble: Fortran 66 did not specify that loops should be executed at least once. That was an extension implemented by certain compilers, not always reliably. The form later adopted by f77 was already implemented successfully by certain compilers.
0 Kudos
reidar_tyssen
Beginner
736 Views

As advised, the solution was to select Project from the menu, then

MyProject Property Pages -> Fortran -> Language and set the

Enable Fortran 66 semantics switch to No

My DO-loops are now running as usual..

Thanks to all of you!

Best regards

Reidarsmiley [:-)]

0 Kudos
Reply