diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp index c24dcf030deb74..33f0f87108d938 100644 --- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp @@ -3800,7 +3800,10 @@ Error BitcodeReader::parseModule(uint64_t ResumeBit, std::string S; if (convertToString(Record, 0, S)) return error("Invalid record"); - TheModule->setDataLayout(S); + Expected MaybeDL = DataLayout::parse(S); + if (!MaybeDL) + return MaybeDL.takeError(); + TheModule->setDataLayout(MaybeDL.get()); break; } case bitc::MODULE_CODE_ASM: { // ASM: [strchr x N] diff --git a/llvm/test/Bitcode/invalid-functionptr-align.ll b/llvm/test/Bitcode/invalid-functionptr-align.ll index be7ce49e4d5392..8b446d371f6fde 100644 --- a/llvm/test/Bitcode/invalid-functionptr-align.ll +++ b/llvm/test/Bitcode/invalid-functionptr-align.ll @@ -1,5 +1,5 @@ ; Bitcode with invalid function pointer alignment. -; RUN: not --crash llvm-dis %s.bc -o - 2>&1 | FileCheck %s +; RUN: not llvm-dis %s.bc -o - 2>&1 | FileCheck %s -CHECK: LLVM ERROR: Alignment is neither 0 nor a power of 2 +CHECK: error: Alignment is neither 0 nor a power of 2