Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix warning on align directives with non-zero fill value (llvm#67237)
Browse files Browse the repository at this point in the history
luismarques authored and legrosbuffle committed Sep 29, 2023
1 parent 60c0bcc commit 1ac29d5
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion llvm/lib/MC/MCParser/AsmParser.cpp
Original file line number Diff line number Diff line change
@@ -3452,7 +3452,7 @@ bool AsmParser::parseDirectiveAlign(bool IsPow2, unsigned ValueSize) {
}
}

if (HasFillExpr) {
if (HasFillExpr && FillExpr != 0) {
MCSection *Sec = getStreamer().getCurrentSectionOnly();
if (Sec && Sec->isVirtualSection()) {
ReturnVal |=
3 changes: 3 additions & 0 deletions llvm/test/MC/ELF/nobits-non-zero-value.s
Original file line number Diff line number Diff line change
@@ -15,5 +15,8 @@
# CHECK: {{.*}}.s:[[#@LINE+1]]:11: warning: ignoring non-zero fill value in SHT_NOBITS section '.bss'
.align 4, 42

# CHECK-NOT: {{.*}}.s:[[#@LINE+1]]:11: warning: ignoring non-zero fill value in SHT_NOBITS section '.bss'
.align 4, 0

# CHECK: <unknown>:0: error: SHT_NOBITS section '.bss' cannot have non-zero initializers
.long 1

0 comments on commit 1ac29d5

Please sign in to comment.