Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

`getTok().getIdentifier() == ".rept"` check in AsmParser::parseMacroLikeBody() looks wrong #20430

Open Quuxplusone opened 10 years ago

Quuxplusone commented 10 years ago
Bugzilla Link PR20431
Status NEW
Importance P normal
Reported by Nico Weber (nicolasweber@gmx.de)
Reported on 2014-07-23 23:28:23 -0700
Last modified on 2016-01-15 07:40:27 -0800
Version trunk
Hardware PC All
CC artem.tamazov@amd.com, chh@google.com, llvm-bugs@lists.llvm.org, rafael@espindo.la
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
AsmParser::parseMacroLikeBody() contains

    if (Lexer.is(AsmToken::Identifier) &&
        (getTok().getIdentifier() == ".rept")) {
      ++NestLevel;
    }

to support nested .rept blocks. This was added in
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120528/143967.html

The function is also used for .irp and .irpc though – since there's no check
for .irp and .irpc in that line, these can't be nested, and the three
directives can't be nested with each other either. Only .rept can be nested
with itself.

From svn history, this looks like an oversight, not like a conscious decision.
Quuxplusone commented 10 years ago

+espindola; you landed the two patches mentioned above.