[LLVMbugs] [Bug 19559] New: Clang issues incorrect warning when leading [^] scanset is used in scanf()

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Apr 25 09:39:20 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=19559

            Bug ID: 19559
           Summary: Clang issues incorrect warning when leading [^]
                    scanset is used in scanf()
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: llvmbugs at happyjack.org
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

In a C program, the following code:

char foo[1024];
scanf("%[^]% ]", foo);

Causes the following warning:

warning: invalid conversion specifier ' ' [-Wformat-invalid-specifier]

This does not happen with the format string "%[]% ]", indicating that Clang
does not recognize that a closing bracket after the caret does not close the
scanset.

Relevant C99 section is 7.19.6.2p12: “If the conversion specifier begins with
[] or [^], the right bracket character is in the scanlist and the next
following right bracket character is the matching right bracket that ends the
specification; otherwise the first following right bracket character is the one
that ends the specification."

-- 
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/20140425/8717454c/attachment.html>


More information about the llvm-bugs mailing list