Skip to content

fcm make: build: compiler aggressive inlining breaks incremental build assumption #244

@matthewrmshin

Description

@matthewrmshin

Consider a simple case where main.f90 depends on mod1.f90.

! In main.f90
program main
use mod1, only: sub1
integer :: c
call sub1(c, 1, 2)
write(*, '(i0)') c
end program main

! In mod1.f90
module mod1
contains
subroutine sub1(c, a, b)
integer, intent(out) :: c
integer, intent(in) :: a
integer, intent(in) :: b
c = a + b + 1
end subroutine sub1
end module mod1

Some compiler (e.g. Cray), on -O3, may inline logic of mod1.f90 into main.o. If we subsequently change the line c = a + b + 1 to say c = a + b + 20, the module will be recompiled, updating mod1.o but mod1.mod will remain unchanged - as there is no change to the module interface. This causes fcm make to think that it does not need to recompile main.f90, although it will re-link the executable.

The result of the executable will then be wrong in incremental mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions