This is an archive of the discontinued LLVM Phabricator instance.

[X86AsmParser] Fix msan: use-of-uninitialized-value after r311639
ClosedPublic

Authored by krasimir on Aug 24 2017, 6:08 AM.

Details

Summary

CodeGen/ms-inline-asm.c test triggers msan use-of-uninitialized-value here:
llvm/lib/MC/MCParser/AsmParser.cpp:5629:7

Diff Detail

Repository
rL LLVM

Event Timeline

krasimir created this revision.Aug 24 2017, 6:08 AM
coby edited edge metadata.Aug 24 2017, 6:19 AM

@krasimir - was on the process of building the sanitizer and validating, you beat me to it

coby added inline comments.Aug 24 2017, 6:21 AM
include/llvm/MC/MCParser/MCTargetAsmParser.h
118 ↗(On Diff #112540)

minor/style: consider the use of the first constructor (while passing AOK_IntelExpr & loc & len)

krasimir added inline comments.Aug 24 2017, 6:26 AM
include/llvm/MC/MCParser/MCTargetAsmParser.h
118 ↗(On Diff #112540)

I don't understand? Are you talking delegating constructors?

I'm gonna go ahead and commit this to unblock our integration. Will follow-up with style fixups.

This revision was automatically updated to reflect the committed changes.
coby added inline comments.Aug 24 2017, 6:41 AM
include/llvm/MC/MCParser/MCTargetAsmParser.h
118 ↗(On Diff #112540)

indeed. i know it'll force the use of assignment for 'IntelExp', but I deem it as a fair tradeoff

krasimir added inline comments.Aug 24 2017, 6:50 AM
include/llvm/MC/MCParser/MCTargetAsmParser.h
118 ↗(On Diff #112540)

IntelExpr has 5 fields. Plus the first constructor doesn't initialize IntelExp right now. Could you please send a snippet of how the constructors should be reorganized? My delegating constructors knowledge is a bit lacking.

coby added a comment.Aug 24 2017, 7:01 AM
AsmRewrite(SMLoc loc, unsigned len, IntelExpr exp) : AsmRewrite(AOK_IntelExpr, loc, len) { IntelExp = exp; }

Same can be done for the 2nd c'tor (& 'label'). Again - it is a style thingy, nothing too cardinal, if you find the current implementation equivalent/better - keep it

Thank you! I think your suggestion is nice. I'll create a follow-up patch for that!

coby added a comment.Aug 24 2017, 7:34 AM

great :)
and thanks again for taking care of my code mischief