- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have a if statement that is throwing an error with intel fortran.
This had previously worked with compaq fortran.
The statement is:
i=1
If ( i .gt. 1 .and. (.not.DF(i)) .and. DF(i-1))
The compiler states an error on DF subscript is 0 error which is less than lower bound apparently for 3rd statement, but I thought it would be stopped by 1st statement when i = 1.
Any comments?
Thanks
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Fortran doesn't work that way - there is no requirement of left-to right evaluation of logical operands nor of "short circuiting". The compiler is allowed to evaluate "any logically equivalent expression" it cares to.
Use nested IF-THEN to protect the second expression.
Use nested IF-THEN to protect the second expression.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Steve,
This did work fine in CVF.
Was there a change when it became Intel?
Also is there a list of differences that might help convert to intel from CVF?
Thanks
Ken
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is another one.
do while( i .le. 80 .and. (.not.DF(i)))
It throws an array out of bounds error on the DF when i=81.
I guess I'll split that one up also.
Do logicals get if check before integers?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If it "worked", it was by accident, not design. It's entirely up to the compiler's optimization as to what gets evaluated when. With CVF, we had plenty of complaints where it didn't work the way you thought it would.
This is not a change - you are relying on undefined behavior.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page