[PATCH] D71443: [MC][PowerPC] Fix a crash when redefining a symbol after .set
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 9 22:28:53 PDT 2020
MaskRay added a comment.
In D71443#1973732 <https://reviews.llvm.org/D71443#1973732>, @nemanjai wrote:
> @MaskRay @luporl Is it possible for `Sym` to be `null` here? Do we need a `nullptr` check? I ask because we seem to have a crash here reported in https://bugs.llvm.org/show_bug.cgi?id=45366 that we cannot reproduce. But I wonder if perhaps this might be the issue.
>
> I have asked the OP of the PR to try the patch that adds the null check, but I was hoping to get your opinion on this as well.
In a -DLLVM_ENABLE_ASSERTIONS=on build, `Sym` can't be `nullptr`. Might to good to ask the OP of https://bugs.llvm.org/show_bug.cgi?id=45366 whether this can be reproduced
void emitAssignment(MCSymbol *S, const MCExpr *Value) override {
auto *Symbol = cast<MCSymbolELF>(S); //////////// asserted to be non-null
// When encoding an assignment to set symbol A to symbol B, also copy
// the st_other bits encoding the local entry point offset.
if (copyLocalEntry(Symbol, Value))
UpdateOther.insert(Symbol); ///////// only way an element is inserted into UpdateOther
else
UpdateOther.erase(Symbol);
}
Here is the only caller of `llvm::MCTargetStreamer::emitAssignment`
// https://github.com/llvm/llvm-project/blob/master/llvm/lib/MC/MCStreamer.cpp#L966
void MCStreamer::emitAssignment(MCSymbol *Symbol, const MCExpr *Value) {
visitUsedExpr(*Value);
Symbol->setVariableValue(Value);
MCTargetStreamer *TS = getTargetStreamer();
if (TS)
TS->emitAssignment(Symbol, Value); //////////// Symbol can't be nullptr
}
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D71443/new/
https://reviews.llvm.org/D71443
More information about the llvm-commits
mailing list