Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
matthewrmshin opened this issue Apr 7, 2017 · 2 comments
Milestone

Comments

@matthewrmshin
Copy link
Member

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.

@matthewrmshin matthewrmshin added this to the later milestone Apr 7, 2017
@steoxley
Copy link
Contributor

Is the fix in this case to simply add a dependency on the .o as well as the .mod or is it more complicated than this?

Developers of VAR occasionally have issues with incremental builds and I would like to rule this out as being the cause before investigating further.

@matthewrmshin
Copy link
Member Author

Is the fix in this case to simply add a dependency on the .o as well as the .mod or is it more complicated than this?

Probably.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants