[clang] [Clang] Allow the value of unroll count to be zero in `#pragma GCC unroll` and `#pragma unroll` (PR #88666)

via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 20 15:57:12 PDT 2024


alexfh wrote:

After this patch clang doesn't accept integer template argument as a parameter of `#pragma unroll` (https://gcc.godbolt.org/z/Woc7zs3sK):
```
template<int Unroll>
void test(int *List, int Length) {
  int i = 0;
#pragma unroll Unroll
  while (i + 1 < Length) {
    List[i] = i;
  }
}
```

```
<source>:4:16: error: expression is not an integral constant expression
    4 | #pragma unroll Unroll
      |                ^~~~~~
```

Please fix soon or revert. Thanks!

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


More information about the cfe-commits mailing list