Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29249 Discussions

break in visual studio on ifort run time warnings

Scott_L_
New Contributor I
492 Views

 

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

 

0 Kudos
1 Reply
Steven_L_Intel1
Employee
492 Views

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
         

 

0 Kudos
Reply