Quantcast
Channel: Intel® Software - Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2746

iford 19.0 bug recursive procedure with optional, value dummy argument

$
0
0

Hi,

I get a segmentation fault, when running the following program compiled with iford 19.0 without any compiler options on linux.

! ifort (IFORT) 19.0.1.144 20181018
program ifort_bug_recursive_procedure_optional_value_dummy_argument
    implicit none

    ! works fine
    call sub(10, 0, 5)

    ! forrtl: severe (174): SIGSEGV, segmentation fault occurred
    call sub(10, 0)
    
contains
    recursive subroutine sub(max, current, depth) ! iford bug if depth absent
        integer, intent(in) :: max
        integer, intent(in) :: current
        integer, value, optional :: depth
        ! integer, intent(in), optional :: depth ! fixes the bug

        logical :: step_in
        step_in = .true.
        if (present(depth)) then
            if (current > depth) return
            if (depth == 0) step_in = .false.
        end if

        if(step_in.and.(max >= current)) then
            print *, current
            ! if (present(depth)) then ! fixes the bug
                call sub(max, current+1, depth)
            ! else
            !     call sub(max, current+1)
            ! end if
        end if

    end subroutine sub
end program ifort_bug_recursive_procedure_optional_value_dummy_argument

 


Viewing all articles
Browse latest Browse all 2746

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>