Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
2 Views

boundary check no warning

Hello,

I discovered that the runtime boundary check is not causing any warning in following program. Is this intended?

Intel(R) Visual Fortran Compiler 19.0.5.281 [IA-32]

/nologo /debug:full /Od /warn:all /module:"Debug\\" /object:"Debug\\" /Fd"Debug\vc160.pdb" /traceback /check:all /libs:dll /threads /dbglibs /c
MODULE no_warning_mod
    IMPLICIT NONE
    PRIVATE
    PUBLIC :: no_warning, no_warning1
    INTERFACE no_warning
        MODULE PROCEDURE no_warning1
        MODULE PROCEDURE no_warning2
    END INTERFACE
CONTAINS
    SUBROUTINE no_warning1(z)
        IMPLICIT NONE
    
        INTEGER, INTENT(IN) :: z(:)
    
    END SUBROUTINE no_warning1
    
    SUBROUTINE no_warning2(z)
        IMPLICIT NONE
    
        INTEGER, INTENT(INOUT) :: z(:, :)
    
    END SUBROUTINE no_warning2
END MODULE no_warning_mod
    
PROGRAM MWE_boundary_check
    USE no_warning_mod
    IMPLICIT NONE
    
    INTEGER :: x(10, 02), i
    
    x(:, 1) = [(i, i = 1, 10)]
    x(:, 2) = [(i, i = 101, 110)]
    
    ! works as intended
    CALL no_warning(x(:, 2))
    
    ! no warning
    CALL no_warning(x(:, 3))
    
    ! no warning
    CALL no_warning1(x(:, 3))
    
    ! warns
    !x(:, 1) = x(:, 3)
    
END PROGRAM MWE_boundary_check

 

0 Kudos
1 Reply
Highlighted
2 Views

The bounds checking occurs on

The bounds checking occurs on the access out of bounds. Try modifying your two subroutines to access the supplied arrays (with bounds issues).

Jim Dempsey

0 Kudos