This is an archive of the discontinued LLVM Phabricator instance.

Bitcode: Fix assert when writing arrays as blobs.
Needs ReviewPublic

Authored by bartell on Sep 27 2018, 7:49 PM.

Details

Reviewers
pcc
Summary

When BitstreamWriter::EmitRecordWithAbbrevImpl is used to write a blob, but the blob data is provided in the Vals array argument instead of the Blob argument, it triggers an assertion failure. This happens because RecordIdx isn't updated correctly, so it looks like there are still unemitted values left in the Vals array. We fix this by updating RecordIdx to reflect the fact that everything in Vals has been emitted.

(LLVM currently always provides blob data in the Blob argument, so it can't trigger this bug as-is.)

Diff Detail

Event Timeline

bartell created this revision.Sep 27 2018, 7:49 PM
pcc added a comment.Oct 19 2018, 12:45 PM

I didn't even know that you could pass a blob that way. What do you think about dropping support for this feature since it is evidently unused (except possibly by you? But you can switch to EmitRecordWithBlob, right?)