- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a code with a simple do loop, DO I = J,K, with I,J,K all Integer(4).
For handling exceptional situations the limits sometimes get set to large values. In particular sometimes one has J = HUGE(J) and K = - HUGE(K). The intention is that the loop won't execute in this situation. However on CVF 6.6 it is executed at least once (it fails in the first iteration so I don't know if it would try to execute a second time). I guess the number of possible iterations is calculated as K-J+1 and, while this should be negative, it overflows to give a positive number. Using HUGE(J)/4, -HUGE(K)/4 works fine.
I realise CVF 6.6 is no longer supported (I have a copy of Intel 9.0 and am intending to change soon). However I am curious to know whether this is a compiler bug or is consistent with the Fortran standard (in which case I'll have to be much more careful in using HUGE in future). Thanks for any help.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

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