New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[c] Parse exception with inline assembly #4635
Comments
Thanks for the report. I could reproduce it in master and also in #4397. The problem is the following fragment (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arc/include/asm/entry-arcv2.h#n184):
The lexer doesn't know about assembly so it doesn't recognize the first line as a comment. It then tries to parse the part after the apostrophe as a character literal, which fails when it consumes up to the line ending. There are two problems here
|
Great.
I wouldn't bother recognising the asm necessarily; I think as long as you don't choke on it, then it's OK. |
Ref pmd#4635 Col number of zero may happen when the error is reported on a newline. In the rest of PMD a newline is considered to sit at the last index of the previous line. So the index is now the first character of the next line, which is slightly wrong but that doesn't matter much.
I think, this can be reproduced for java with the following snipped: public class Foo {
String s = "abc";"
String s2 = "xyz";
} Notice the unbalanced quote in line 2... |
This is fixed with #4694
This is still open. |
Affects PMD Version:
7.0.0-rc3
Description:
I've been trying pmd on the Linux kernel source, and I'm getting a crash on the arch/arc subdirectory, I've narrowed it down to the file arch/arc/include/asm/entry-arcv2.h
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arc/include/asm/entry-arcv2.h
A clear and concise description of what the bug is.
The following crashes, originally found with just --dir arch but I narrowed it down to that file, which is actually arc asm.
$ pmd cpd --minimum-tokens 100 --language c --dir arch/arc/include/asm/entry-arcv2.h
Code Sample demonstrating the issue:
see above header from kernel
Steps to reproduce:
Please provide detailed steps for how we can reproduce the bug.
Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]
CLI
running on Fedora 38 Linux x86-64
$ java --version
openjdk 17.0.7 2023-04-18
OpenJDK Runtime Environment (Red_Hat-17.0.7.0.7-4.fc38) (build 17.0.7+7)
OpenJDK 64-Bit Server VM (Red_Hat-17.0.7.0.7-4.fc38) (build 17.0.7+7, mixed mode, sharing)
The text was updated successfully, but these errors were encountered: