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

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 30 09:51:35 PDT 2025


alexey-bataev wrote:

> In the current implementation I switched to using OrigVar->getType() to get the variable’s Type. Now getTypeSize() correctly returns 8 bits for char, 16 for short, 64 for long, etc. That means code like now rejects, whereas it used to compile.

I think it should be compiled, unless you implement a range check. The type of the unrolling factor should not affect the compilation, only the value range.

> One remaining concern: the bit-width check treats all iteration variables as unsigned. It doesn’t account for signed types. Should I add a separate signed-range check, as suggested here in this https://github.com/llvm/llvm-project/issues/139268#issuecomment-2867068205?

Bit-width should not affect compilation, only potential value range

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


More information about the cfe-commits mailing list