jeanPerier c87e94b030
[flang] Get ProvenanceRange from CharBlock starting with expanded macro (#77791)
When a CharBlock starts with an expanded macro but does not end in this
macro expansion, GetProvenanceRange fails to return a ProvenanceRange
which may cause error message to be emitted without location or lowering
to emit code without source location (which is problematic if this code
contains calls to procedures defined in the same file since LLVM will
later crash with the error:
"inlinable function call in a function with a DISubprogram location must
have a debug location"

Fix this situation by returning the ProvenanceRange starting at the
replaced macro reference.
2024-01-12 13:04:50 +01:00

13 lines
418 B
Fortran

! RUN: %python %S/test_errors.py %s %flang_fc1
! Test error location when assignment starts with macro expansion.
#define X_VAR x
program main
real(4) :: x
character(10) :: c
!ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types REAL(4) and CHARACTER(KIND=1)
X_VAR = c
!ERROR: No intrinsic or user-defined ASSIGNMENT(=) matches operand types CHARACTER(KIND=1) and REAL(4)
c = X_VAR
end