[llvm-bugs] [Bug 46919] New: Integrated assembler errors on #(label-.-8): error: constant expression expected

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Jul 30 14:15:12 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=46919

            Bug ID: 46919
           Summary: Integrated assembler errors on #(label-.-8): error:
                    constant expression expected
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: ARM
          Assignee: unassignedbugs at nondot.org
          Reporter: i at maskray.me
                CC: llvm-bugs at lists.llvm.org, smithp352 at googlemail.com,
                    Ties.Stuij at arm.com

cat > a.s <<e
str r1, [pc, #(rewrite_3 - . - 8)]
cmp r0, #0
nop
rewrite_3:
e

% llvm-mc -filetype=obj -triple armv8 a.s
a.s:1:15: error: constant expression expected
str r1, [pc, #(rewrite_3 - . - 8)]
              ^

This may be tricky to fix because when #(rewrite_1 - . - 8) is parsed, we don't
know rewrite_1 is defined and thus we cannot fold `rewrite_1 - .`
The `MCConstExpr *` operand is immediately stored to to the
ARMOperand::MemoryOp::OffsetImm field. The field is referenced ~80 times and
many use sites assume that it is a MCConstantExpr. We may have to defer the
creation of the field to address the issue.


Call stack:

llvm/lib/MC/MCParser/AsmParser.cpp AsmParser::Run
llvm/lib/MC/MCParser/AsmParser.cpp AsmParser::parseStatement
llvm/include/llvm/MC/MCParser/MCTargetAsmParser.h
MCTargetAsmParser::ParseInstruction
llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp ARMAsmParser::ParseInstruction
llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp ARMAsmParser::parseOperand
llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp ARMAsmParser::parseMemory

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200730/838e8680/attachment.html>


More information about the llvm-bugs mailing list