From: Owen Anderson Date: Mon, 2 Mar 2015 09:34:59 +0000 (+0000) Subject: Teach DataLayout that ABI alignments for non-aggregate types must be non-zero. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ab1c7a77d27d5482f2159bc26297d875db13b936;p=platform%2Fupstream%2Fllvm.git Teach DataLayout that ABI alignments for non-aggregate types must be non-zero. This manifested as assertions and/or crashes in later phases of optimization, depending on the build configuration. llvm-svn: 230939 --- diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp index 4eb6d78..b6eaf6f2 100644 --- a/llvm/lib/IR/DataLayout.cpp +++ b/llvm/lib/IR/DataLayout.cpp @@ -312,6 +312,9 @@ void DataLayout::parseSpecifier(StringRef Desc) { "Missing alignment specification in datalayout string"); Split = split(Rest, ':'); unsigned ABIAlign = inBytes(getInt(Tok)); + if (AlignType != AGGREGATE_ALIGN && !ABIAlign) + report_fatal_error( + "ABI alignment specification must be >0 for non-aggregate types"); // Preferred alignment. unsigned PrefAlign = ABIAlign; diff --git a/llvm/test/Assembler/invalid-datalayout22.ll b/llvm/test/Assembler/invalid-datalayout22.ll new file mode 100644 index 0000000..14e4c28 --- /dev/null +++ b/llvm/test/Assembler/invalid-datalayout22.ll @@ -0,0 +1,6 @@ +; RUN: not llvm-as < %s 2>&1 | FileCheck %s + +target datalayout = "v128:0:128" + +; CHECK: ABI alignment specification must be >0 for non-aggregate types +