[LLVMbugs] [Bug 2815] New: escaped chars in string literal cause incorrect caret position in diagnostic messages
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Sun Sep 21 16:48:16 PDT 2008
http://llvm.org/bugs/show_bug.cgi?id=2815
Summary: escaped chars in string literal cause incorrect caret
position in diagnostic messages
Product: clang
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: trivial
Priority: P2
Component: Basic
AssignedTo: unassignedbugs at nondot.org
ReportedBy: richard at godbee.net
CC: llvmbugs at cs.uiuc.edu
Given the following code...
main() {
printf("\0");
printf("\n\0");
printf("\n\n\0");
printf("\n\n\n\0");
return 0;
}
...clang (r56415) produces the following diagnostics...
c.c:2:9: warning: format string contains '\0' within the string body
printf("\0");
~^~~
c.c:3:10: warning: format string contains '\0' within the string body
printf("\n\0");
~~^~~~
c.c:4:11: warning: format string contains '\0' within the string body
printf("\n\n\0");
~~~^~~~~
c.c:5:12: warning: format string contains '\0' within the string body
printf("\n\n\n\0");
~~~~^~~~~~
4 diagnostics generated.
Note that the carets are pointing to the wrong positions in all cases except
the first. Whatever code determines the caret's position (and length?) seems
to be treating escaped characters as only taking up one char in the source
code. The same problem is seen with "\xNN" (hex) and "\NNN" (octal) escapes.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list