[LLVMbugs] [Bug 18599] New: AsmParser::parseDirectiveMacro can't parse recursive macro definition

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jan 24 00:06:48 PST 2014


            Bug ID: 18599
           Summary: AsmParser::parseDirectiveMacro can't parse recursive
                    macro definition
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: MC
          Assignee: unassignedbugs at nondot.org
          Reporter: manjian2006 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 11929
  --> http://llvm.org/bugs/attachment.cgi?id=11929&action=edit
source that cause bug

libjpeg_turbo/simd/jsimd_arm_neon.S defines a macro like this:
.macro generate_jsimd_rgb_ycc_convert_neon colorid, bpp, r_offs, g_offs, b_offs

 * 2 stage pipelined RGB->YCbCr conversion

.macro do_rgb_to_yuv_stage1
.endm // do_rgb_to_yuv_stage1 ends

.macro do_rgb_to_yuv_stage2
.endm // generate_jsimd_rgb_ycc_convert_neon ends

and this is how  AsmParser::parseDirectiveMacro handle it :
  // Lex the macro definition.
  for (;;) {
    // Check whether we have reached the end of the file.
    if (getLexer().is(AsmToken::Eof))
      return Error(DirectiveLoc, "no matching '.endmacro' in definition");

    // Otherwise, check whether we have reach the .endmacro.
    if (getLexer().is(AsmToken::Identifier) &&
        (getTok().getIdentifier() == ".endm" ||
=>         getTok().getIdentifier() == ".endmacro")) {
      EndToken = getTok();
      if (getLexer().isNot(AsmToken::EndOfStatement))
        return TokError("unexpected token in '" + EndToken.getIdentifier() +
                        "' directive");

that apparently have not consider the situation where n macro define

that make BodyStart points to  ".macro do_rgb_to_yuv_stage1",whereas BodyEnd
points to ".endm // do_rgb_to_yuv_stage1 ends"

This should be fixed.

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/20140124/6fa7f49a/attachment.html>

More information about the llvm-bugs mailing list