A customer reported an issue which I have reduced to the test in the PR. If built with debug info enabled, the build fails with the following error in the verifier. !dbg attachment points at wrong subprogram for function The problem happened because some of the functions in OMPIRBuilder.cpp updated the insertion point with the passed in location but did not change the current debug location. This caused a stale debug location to be attached to the instruction. I have solved it by replacing restoreIP with updateToLocation which updates both the insertion point and debug location. The updateToLocation is used in many places already, so this PR brings functions that I have changed in line with rest of the file. Slight issue is that I am not checking the return type of updateToLocation as there is no good value I could return in that case. But if we have a condition where updateToLocation will return false, these functions will fail in any case. I have added a test that checks that build does not fail. I was not sure what is the correct location for the test should be. Happy to move it to more appropriate location.
31 lines
543 B
Fortran
31 lines
543 B
Fortran
!RUN: %flang_fc1 -emit-llvm -debug-info-kind=line-tables-only -fopenmp %s -o - | FileCheck %s
|
|
|
|
! Test that this file builds without an error.
|
|
|
|
module debugloc
|
|
contains
|
|
subroutine test1
|
|
implicit none
|
|
integer :: i
|
|
real, save :: var
|
|
|
|
! CHECK: DILocation(line: [[@LINE+1]], {{.*}})
|
|
!$omp parallel do
|
|
do i=1,100
|
|
var = var + 0.1
|
|
end do
|
|
!$omp end parallel do
|
|
|
|
end subroutine test1
|
|
|
|
subroutine test2
|
|
|
|
real, save :: tp
|
|
!$omp threadprivate (tp)
|
|
! CHECK: DILocation(line: [[@LINE+1]], {{.*}})
|
|
tp = tp + 1
|
|
|
|
end subroutine test2
|
|
|
|
end module debugloc
|