summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/DataLayout.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2015-03-02 06:00:02 +0000
committerOwen Anderson <resistor@mac.com>2015-03-02 06:00:02 +0000
commit5bc2bbe60191aa65faeb0a8f48e94750a826f42b (patch)
treec2441ea1fbfba2c476fd5e2410e9f42efcd72fb0 /llvm/lib/IR/DataLayout.cpp
parent576a9a2728505d81849e3a15cdbc70d398fb95c6 (diff)
downloadbcm5719-llvm-5bc2bbe60191aa65faeb0a8f48e94750a826f42b.tar.gz
bcm5719-llvm-5bc2bbe60191aa65faeb0a8f48e94750a826f42b.zip
Teach DataLayout that zero-byte pointer sizes don't make sense.
Previously this would result in assertion failures or simply crashes at various points in the optimizer when trying to create types of zero bit width. llvm-svn: 230936
Diffstat (limited to 'llvm/lib/IR/DataLayout.cpp')
-rw-r--r--llvm/lib/IR/DataLayout.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp
index 9c1dee0cfb7..c414e80f410 100644
--- a/llvm/lib/IR/DataLayout.cpp
+++ b/llvm/lib/IR/DataLayout.cpp
@@ -259,6 +259,8 @@ void DataLayout::parseSpecifier(StringRef Desc) {
"Missing size specification for pointer in datalayout string");
Split = split(Rest, ':');
unsigned PointerMemSize = inBytes(getInt(Tok));
+ if (!PointerMemSize)
+ report_fatal_error("Invalid pointer size of 0 bytes");
// ABI alignment.
if (Rest.empty())
OpenPOWER on IntegriCloud