mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
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
This commit is contained in:
parent
39b32da21b
commit
22efff3c98
@ -259,6 +259,8 @@ void DataLayout::parseSpecifier(StringRef Desc) {
|
|||||||
"Missing size specification for pointer in datalayout string");
|
"Missing size specification for pointer in datalayout string");
|
||||||
Split = split(Rest, ':');
|
Split = split(Rest, ':');
|
||||||
unsigned PointerMemSize = inBytes(getInt(Tok));
|
unsigned PointerMemSize = inBytes(getInt(Tok));
|
||||||
|
if (!PointerMemSize)
|
||||||
|
report_fatal_error("Invalid pointer size of 0 bytes");
|
||||||
|
|
||||||
// ABI alignment.
|
// ABI alignment.
|
||||||
if (Rest.empty())
|
if (Rest.empty())
|
||||||
|
6
test/Assembler/invalid-datalayout19.ll
Normal file
6
test/Assembler/invalid-datalayout19.ll
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
; RUN: not llvm-as < %s 2>&1 | FileCheck %s
|
||||||
|
|
||||||
|
target datalayout = "p:0:32:32"
|
||||||
|
|
||||||
|
; CHECK: Invalid pointer size of 0 bytes
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user