Fix for PR43175: compiler crash when trying to emit noncapturable
authorAlexey Bataev <a.bataev@hotmail.com>
Tue, 10 Sep 2019 19:16:56 +0000 (19:16 +0000)
committerAlexey Bataev <a.bataev@hotmail.com>
Tue, 10 Sep 2019 19:16:56 +0000 (19:16 +0000)
commitb5890a329a08715f1974f5f46f1205f2ca1de41e
tree6536e71990327658f197a8a59763c9b039abc03e
parenta9beacbac8d22f2b796130766ff7f8c93af131f2
Fix for PR43175: compiler crash when trying to emit noncapturable
constant.

If the constexpr variable is partially initialized, the initializer can
be emitted as the structure, not as an array, because of some early
optimizations. The llvm variable gets the type from this constant and,
thus, gets the type which is pointer to struct rather than pointer to an
array. We need to convert this type to be truely array, otherwise it may
lead to the compiler crash when trying to emit array subscript
expression.

llvm-svn: 371548
clang/lib/CodeGen/CGExpr.cpp
clang/test/OpenMP/constexpr_partial_array.cpp [new file with mode: 0644]