diff options
author | Yaron Keren <yaron.keren@gmail.com> | 2015-08-04 15:57:04 +0000 |
---|---|---|
committer | Yaron Keren <yaron.keren@gmail.com> | 2015-08-04 15:57:04 +0000 |
commit | 13631242fe9fb3ed76c00f27ba193155ce054890 (patch) | |
tree | 9e39db4881f79e4ae9b507f74bf1439455c00bce | |
parent | 07f42cd526c51131d1748e3be8683d24c396d9eb (diff) | |
download | bcm5719-llvm-13631242fe9fb3ed76c00f27ba193155ce054890.tar.gz bcm5719-llvm-13631242fe9fb3ed76c00f27ba193155ce054890.zip |
Avoid passing nullptr to std::equal.
As documented in the LLVM Coding Standards, indeed MSVC incorrectly asserts
on this in Debug mode. This happens when building clang with Visual C++ and
-triple i686-pc-windows-gnu on these clang regression tests:
clang/test/CodeGen/2011-03-08-ZeroFieldUnionInitializer.c
clang/test/CodeGen/empty-union-init.c
llvm-svn: 243996
-rw-r--r-- | llvm/lib/IR/Type.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/IR/Type.cpp b/llvm/lib/IR/Type.cpp index 18c2e8c2b48..2f6dbab7201 100644 --- a/llvm/lib/IR/Type.cpp +++ b/llvm/lib/IR/Type.cpp @@ -612,7 +612,8 @@ bool StructType::isLayoutIdentical(StructType *Other) const { getNumElements() != Other->getNumElements()) return false; - return std::equal(element_begin(), element_end(), Other->element_begin()); + return element_begin() && + std::equal(element_begin(), element_end(), Other->element_begin()); } /// getTypeByName - Return the type with the specified name, or null if there |