break in visual studio on ifort run time warnings

break in visual studio on ifort run time warnings

 

Is there a way to have visual studio (2012) break on intel fortran run time warnings like:

forrtl: warning (402): fort: (1): In call to I/O Write routine, an array temporary was created for argument #2

 

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

In the current version, no. In version 15, coming out later this year, yes, by using the new library routine ESTABLISHQQ to establish a run-time handler for Fortran errors. You could then do something like this:

    use ifestablish
    integer array(50)
    procedure(establishqq_handler) :: handler
    integer (int_ptr_kind()) :: context
    logical :: ret
    
    ret =  establishqq(handler, context)
    array = 1
    call sub (array(1:49:2))
    print *, array
    end
    
    subroutine sub (a)
    integer a(*)
    do i=1,25
        a(i) = 2 * i
    end do
    end subroutine sub
    
    function handler (error_code, continuable, message_string, context)
     use kernel32
     use foriosdef
     implicit none
     logical :: handler

     ! Arguments
     !
     integer, intent(in) :: error_code          ! RTL error code from IOSTAT table
     logical, intent(in) :: continuable         ! True if condition is continuable
     character(*), intent(in) :: message_string ! Formatted message string a la ERRMSG/IOMSG
     integer, intent(in) :: context             ! Address-sized integer as passed in to call to ESTABLISHQQ                                                 ! For whatever purpose the programmer desires.
     handler = .TRUE. ! Continue by default
     
     if (error_code == FOR$IOS_WARN_TBACK) then  ! Runtime warning with traceback
         print *, message_string
         if (IsDebuggerPresent() /= 0) call DebugBreak ! Break into debugger
     end if
     
     end function handler
         

 

Retired 12/31/2016

Leave a Comment

Please sign in to add a comment. Not a member? Join today