[clang] [OpenMP] Fix crash with extern reference variable in collapsed loop. (PR #203252)
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 11 07:51:00 PDT 2026
================
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 %s
+// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=51 %s
+
+// expected-no-diagnostics
+
+// Verify no crash when collapsing a loop nest where the induction variable
+// is an extern reference type. PR/issue: null dereference in getInitLCDecl
+// when VarDecl::getDefinition() returns nullptr.
+
+extern int &dim;
+auto test() {
+#pragma omp parallel for collapse(2)
+ for (int i = 0; i < dim; ++i) {
+ for (i = 0; i < 10; i++) {
----------------
alexey-bataev wrote:
Shall we report the error here instead?
https://github.com/llvm/llvm-project/pull/203252
More information about the cfe-commits
mailing list