- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following example is taken from Nick MacLaren's slides (Cambridge Univ.)
gfortran, on the other hand, does recongize the problem and emits an error message during compilation.
[plain]program intoverflowWhen compiled by ifort (v11.1.046) the overflow is not signaled and n3 becomes equal to 1537032704 instead of 5832000000.
integer, parameter :: n=1800
integer :: n3
! real :: my_data(n*n*n) <---- Ooops here
n3 = n*n*n
print *, 'n^3 =', n3
end program intoverflow[/plain]
gfortran, on the other hand, does recongize the problem and emits an error message during compilation.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - eliosh
The following example is taken from Nick MacLaren's slides (Cambridge Univ.)
gfortran, on the other hand, does recongize the problem and emits an error message during compilation.
[plain]program intoverflowWhen compiled by ifort (v11.1.046) the overflow is not signaled and n3 becomes equal to 1537032704 instead of 5832000000.
integer, parameter :: n=1800
integer :: n3
! real :: my_data(n*n*n) <---- Ooops here
n3 = n*n*n
print *, 'n^3 =', n3
end program intoverflow[/plain]
gfortran, on the other hand, does recongize the problem and emits an error message during compilation.
This question comes up from time to time. There is a feature request to enable a compile time check for just such a situation. However, there is no requirement in the Fortran standard to emit an error for this scenario. This feature request is currently on our list but there is no timeline for it's implementation.

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