- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Which compiler options must i activate in order to have a traceback when a floating overflow occurs ?
TIA
TIA
Link Copied
7 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
/fpe0 /traceback
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Don't work.
Result :
forrtl: error (72): floating overflow
and trace back has "unknown"
for every Routine Line and Source 1
Regards
Result :
forrtl: error (72): floating overflow
and trace back has "unknown"
for every Routine Line and Source 1
Regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi jhjensen
You may want to try the intrinsic IEEE_EXCEPTIONS module and monitor the exceptions flag. (Below is a very terse snippet.) This will not "generate traceback" per say; but gives you more control.
Yet another possibility, if you are using Visual Studio, is to enable Debug--> Exception --> Win32 exceptions.
Abhi
-------
Program Test_TrapFloatingPoint
Use IEEE_EXCEPTIONS
Implicit None
Real(8) :: x, y, z
Logical :: Exception(5)
Call Random_Seed()
Call Random_number(x)
Write(*,*) "Give a real number"
Read *, y
z = x/y
! Exception = [IEEE_OVERFLOW, IEEE_DIVIDE_BY_ZERO,
! IEEE_INVALID, IEEE_UNDERFLOW, IEEE_INEXACT]
Call IEEE_GET_FLAG(IEEE_ALL, Exception)
if (ANY(Exception)) then
Write(*,*)
Write(*,*) "IEEE exception flags are:-"
Write(*,*)
Write(*,*) "IEEE_OVERFLOW:", Exception(1)
Write(*,*) "IEEE_DIVIDE_BY_ZERO:", Exception(2)
Write(*,*) "IEEE_INVALID:", Exception(3)
Write(*,*) "IEEE_UNDERFLOW:", Exception(4)
Write(*,*) "IEEE_INEXACT:", Exception(5)
else
Write(*,*) "Operation completed successfully."
endif
End Program Test_TrapFloatingPoint
You may want to try the intrinsic IEEE_EXCEPTIONS module and monitor the exceptions flag. (Below is a very terse snippet.) This will not "generate traceback" per say; but gives you more control.
Yet another possibility, if you are using Visual Studio, is to enable Debug--> Exception --> Win32 exceptions.
Abhi
-------
Program Test_TrapFloatingPoint
Use IEEE_EXCEPTIONS
Implicit None
Real(8) :: x, y, z
Logical :: Exception(5)
Call Random_Seed()
Call Random_number(x)
Write(*,*) "Give a real number"
Read *, y
z = x/y
! Exception = [IEEE_OVERFLOW, IEEE_DIVIDE_BY_ZERO,
! IEEE_INVALID, IEEE_UNDERFLOW, IEEE_INEXACT]
Call IEEE_GET_FLAG(IEEE_ALL, Exception)
if (ANY(Exception)) then
Write(*,*)
Write(*,*) "IEEE exception flags are:-"
Write(*,*)
Write(*,*) "IEEE_OVERFLOW:", Exception(1)
Write(*,*) "IEEE_DIVIDE_BY_ZERO:", Exception(2)
Write(*,*) "IEEE_INVALID:", Exception(3)
Write(*,*) "IEEE_UNDERFLOW:", Exception(4)
Write(*,*) "IEEE_INEXACT:", Exception(5)
else
Write(*,*) "Operation completed successfully."
endif
End Program Test_TrapFloatingPoint
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can you show us a short sample that doesn't work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
PROGRAM TESTOVERFLOW
real r
integer i,n
write(*,*) 'Hello world'
read(*,*) i
r=1.
n=45
do i=1,n
r=r*10.
end do
write(*,*) 'r= ',r
read(*,*) i
END
compile and link:
ifort /c /MW /traceback /check:all /warn:nodeclarations /Qzero /fpe0 testoverflow.for
link /subsystem:windows testoverflow
Running will produce overflow error but no traceback line numbers
Regards
JHJ
real r
integer i,n
write(*,*) 'Hello world'
read(*,*) i
r=1.
n=45
do i=1,n
r=r*10.
end do
write(*,*) 'r= ',r
read(*,*) i
END
compile and link:
ifort /c /MW /traceback /check:all /warn:nodeclarations /Qzero /fpe0 testoverflow.for
link /subsystem:windows testoverflow
Running will produce overflow error but no traceback line numbers
Regards
JHJ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Interesting. Your use of /subsystem:windows and /MW made me wonder if the traceback was being disabled by that but I can see the same effect with a console application. I'll ask the developers about this. Issue ID is DPD200157968.
I note that compiling with /arch:ia32 allows the traceback to work.
I note that compiling with /arch:ia32 allows the traceback to work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We have found and fixed the cause of this problem, which was improper handling of the exception by the Fortran run-time library. The fix will appear in a future release of the compiler.

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