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: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
                CC: [email protected]


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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to