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

boundary check no warning

Julian_H_
Beginner
632 Views

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
jimdempseyatthecove
Honored Contributor III
632 Views

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
Reply