Index: lib/CodeGen/CGDebugInfo.cpp =================================================================== --- lib/CodeGen/CGDebugInfo.cpp +++ lib/CodeGen/CGDebugInfo.cpp @@ -2181,7 +2181,8 @@ Count = CAT->getSize().getZExtValue(); else if (const auto *VAT = dyn_cast(Ty)) { llvm::APSInt V; - if (VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext())) + if (VAT->getSizeExpr() && + VAT->getSizeExpr()->EvaluateAsInt(V, CGM.getContext())) Count = V.getExtValue(); } Index: test/CodeGenCXX/debug-info-openmp-array.cpp =================================================================== --- test/CodeGenCXX/debug-info-openmp-array.cpp +++ test/CodeGenCXX/debug-info-openmp-array.cpp @@ -0,0 +1,17 @@ +// RUN: %clang -target x86_64-unknown-unknown -fverbose-asm -fopenmp -g -O0 -S -emit-llvm %s -o - | FileCheck %s + + +void f(int m) { + int i; + int cen[m]; +#pragma omp parallel for + for (i = 0; i < m; ++i) { + cen[i] = i; + } +} + +// CHECK: !DICompositeType(tag: DW_TAG_array_type, +// CHECK-NOT: size: +// CHECK-SAME: align: 32 +// CHECK-SAME: elements: [[ELEM_TYPE:![0-9]+]] +// CHECK: !DISubrange(count: -1)