[clang] [Clang][OpenMP] Fix crash on a function name used as an integer clause argument (PR #228864)

Akash Manna via cfe-commits cfe-commits at lists.llvm.org
Sun Oct 4 07:18:30 PDT 2026


================
@@ -54,3 +54,19 @@ int main(int argc, char **argv) {
   {}
   return 0;
 }
+
+extern int omp_is_initial_device(void);
+
+void gh140257(void) {
+  int i = 0, a[2];
+  #pragma omp target device(omp_is_initial_device) // expected-error {{expression must have integral or unscoped enumeration type, not 'int (void)'}}
+  i++;
+  #pragma omp target data map(i) device(omp_is_initial_device) // expected-error {{expression must have integral or unscoped enumeration type, not 'int (void)'}}
+  i++;
+  #pragma omp target map(a[omp_is_initial_device:1]) // expected-error {{expression must have integral or unscoped enumeration type, not 'int (void)'}} expected-error {{array section lower bound is not an integer}}
----------------
akash-manna-sky wrote:

Note: a non-integer array section bound like `map(a[1.5:2])` now gets two errors, because the existing `array section lower bound is not an integer` check finally fires. 

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


More information about the cfe-commits mailing list