[clang] [OpenMP] Add assertion for 'factor' width mismatch in 'unroll partial' (PR #139986)

ALBIN BABU VARGHESE via cfe-commits cfe-commits at lists.llvm.org
Wed May 14 22:18:56 PDT 2025


================
@@ -58,8 +58,17 @@ void func(int n) {
   // expected-error at +1 {{argument to 'partial' clause must be a strictly positive integer value}} 
   #pragma omp unroll partial(0)
   for (int i = 0; i < n; ++i) {}
-    
-  // expected-error at +1 {{directive '#pragma omp unroll' cannot contain more than one 'partial' clause}} 
+
+  // expected-error at +1 {{unroll factor has width 64 but the iteration variable 'int' is only 32 bits wide}}
+  #pragma omp unroll partial(0xFFFFFFFFF)
+  for (int i = 0; i < 10; i++)
----------------
albus-droid wrote:

I realized I was using the wrong loop variable: the type still shows as i32 even after I changed it to char. I should be using OrigVar instead of IVTy. I’ll include that fix along with the other changes.

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


More information about the cfe-commits mailing list