Commit 2a9d186d by Karl Schimpf

Fix error reporting for parallel parsed function blocks.

Fixes error reporting in function blocks by adding a start address with parallel parses, and then using the getErrorBitNo() method of the bitstream cursor to correct error bit number, based on the start address. Dependent on CL https://codereview.chromium.org/1851163002. BUG= https://bugs.chromium.org/p/nativeclient/issues/detail?id=4363 R=stichnot@chromium.org Review URL: https://codereview.chromium.org/1848313003 .
parent d4699947
...@@ -774,7 +774,8 @@ bool BlockParserBaseClass::ErrorAt(naclbitc::ErrorLevel Level, uint64_t Bit, ...@@ -774,7 +774,8 @@ bool BlockParserBaseClass::ErrorAt(naclbitc::ErrorLevel Level, uint64_t Bit,
} else { } else {
StrBuf << Message; StrBuf << Message;
} }
return Context->ErrorAt(Level, Bit, StrBuf.str()); return Context->ErrorAt(Level, Record.GetCursor().getErrorBitNo(Bit),
StrBuf.str());
} }
void BlockParserBaseClass::reportRecordSizeError(size_t ExpectedSize, void BlockParserBaseClass::reportRecordSizeError(size_t ExpectedSize,
...@@ -3106,7 +3107,8 @@ private: ...@@ -3106,7 +3107,8 @@ private:
std::unique_ptr<Ice::Cfg> CfgParserWorkItem::getParsedCfg() { std::unique_ptr<Ice::Cfg> CfgParserWorkItem::getParsedCfg() {
NaClBitstreamCursor &OldCursor(ModParser->getCursor()); NaClBitstreamCursor &OldCursor(ModParser->getCursor());
llvm::NaClBitstreamReader Reader(Buffer.get(), Buffer.get() + BufferSize, llvm::NaClBitstreamReader Reader(OldCursor.getStartWordByteForBit(StartBit),
Buffer.get(), Buffer.get() + BufferSize,
OldCursor.getBitStreamReader()); OldCursor.getBitStreamReader());
NaClBitstreamCursor NewCursor(Reader); NaClBitstreamCursor NewCursor(Reader);
NewCursor.JumpToBit(NewCursor.getWordBitNo(StartBit)); NewCursor.JumpToBit(NewCursor.getWordBitNo(StartBit));
......
; Test that we report a bug at the same place, independent of a parallel parse.
; REQUIRES: no_minimal_build
; RUN: %p2i --expect-fail -i %s --args -threads=0 -parse-parallel=0 \
; RUN: -allow-externally-defined-symbols | FileCheck %s
; RUN: %p2i --expect-fail -i %s --args -threads=1 -parse-parallel=1 \
; RUN: -allow-externally-defined-symbols | FileCheck %s
declare i32 @f();
declare i64 @g();
define void @Test(i32 %ifcn) {
entry:
%fcn = inttoptr i32 %ifcn to i1()*
%v = call i1 %fcn()
; CHECK: Error(222:6): Return type of function is invalid: i1
ret void
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment