I am using XL Fortran v7.1.1.2 under AIX 5.1 and have some unusual behaviour inside an if statement.
I have discovered that the following fortran IF statement does not work the way it appears to read
(code in the if block is NEVER executed):
if ((someFunction(someArg) .eqv. .true. &
.or. someParameter >= 2)) then
The syntax that works is:
if ((someFunction(someArg) .eqv. .true. ) &
.or. someParameter >= 2) then
Note the different bracket positioning.
The syntax details do not clearly explain why the first statement does not work. I have speculated that perhaps the logical expression is being converted into an arithmetic due to the presence of the brackets but other than that it is a bit of a mystery.
Has anyone else also observed this behaviour or have an alternative explanation?
thanks in advance
John
I have discovered that the following fortran IF statement does not work the way it appears to read
(code in the if block is NEVER executed):
if ((someFunction(someArg) .eqv. .true. &
.or. someParameter >= 2)) then
The syntax that works is:
if ((someFunction(someArg) .eqv. .true. ) &
.or. someParameter >= 2) then
Note the different bracket positioning.
The syntax details do not clearly explain why the first statement does not work. I have speculated that perhaps the logical expression is being converted into an arithmetic due to the presence of the brackets but other than that it is a bit of a mystery.
Has anyone else also observed this behaviour or have an alternative explanation?
thanks in advance
John