[llvm] [openmp] [OpenMP][DeviceRTL] Report the source location in __kmpc_error diagnostics (PR #224298)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 2 03:21:41 PDT 2026


================
@@ -22,6 +24,11 @@ program error_directive
 end program error_directive
 
 ! Device output is flushed after host output, so host prints are not checked.
+! Without -g the ident holds no location and is reported as "unknown:0:0", the
+! same as the host runtime.
 
-! CHECK: user-directed warning: warning message.
-! CHECK: user-directed warning.
+! NOLOC: OMP: unknown:0:0: Encountered user-directed warning: warning message.
+! NOLOC: OMP: unknown:0:0: Encountered user-directed warning.
+
+! LOC: {{.*}}error_directive.f90:{{[0-9]+}}:{{[0-9]+}}: Encountered user-directed warning: warning message.
+! LOC: {{.*}}error_directive.f90:{{[0-9]+}}:{{[0-9]+}}: Encountered user-directed warning.
----------------
jprotze wrote:

If you move the two check-lines just above the directive, you should be able to check for the correct line number to be printed:
```suggestion
! LOC: {{.*}}error_directive.f90:[[# @LINE + 1]]:{{[0-9]+}}: Encountered user-directed warning: warning message.
! LOC: {{.*}}error_directive.f90:[[# @LINE + 1]]:{{[0-9]+}}: Encountered user-directed warning.
```

https://github.com/llvm/llvm-project/pull/224298


More information about the llvm-commits mailing list