[MC] Diagnose a negative .fill count through MCContext #6
Loading…
Reference in a new issue
No description provided.
Delete branch "ps2-mc-fill-warning"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
MCObjectStreamer::emitFillprinted the "negative repeat count" warning withgetContext().getSourceManager()->PrintMessage.getSourceManager()is null when the MC layer emits code for input that is not an assembly file, so a negative count in inline assembly (file-scope or in a function) crashed clang. Found with the IRX table macros, where.fill 8-(.-1b), 1, 0goes negative for a module name longer than 8 bytes.It now calls
MCContext::reportWarning, which handles the inline-asm source manager and-w/-Werror. Before: clang crashes. After:<inline asm>:3:8: warning: '.fill' directive with negative repeat count has no effect [-Winline-asm].Test:
CodeGen/Mips/inline-asm-fill-negative.ll(run by hand with llc and FileCheck). Worth sending upstream.🤖 Generated with Claude Code
Pull request closed