[LLVMbugs] [Bug 22451] New: missed diagnostic for scanf %x with signed integer

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Feb 3 16:07:31 PST 2015


            Bug ID: 22451
           Summary: missed diagnostic for scanf %x with signed integer
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: danalbert at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

GCC emits a warning we don't:

$ cat foo.cpp
#include <stdio.h>

int main(int, char**) {
  char buf[BUFSIZ];
  int n;
  sscanf(buf, "%x", &n);
  return 0;
$ g++ -pedantic foo.cpp 
foo.cpp: In function ‘int main(int, char**)’:
foo.cpp:6:23: warning: format ‘%x’ expects argument of type ‘unsigned int*’,
but argument 3 has type ‘int*’ [-Wformat=]
   sscanf(buf, "%x", &n);
$ clang++ -Weverything -pedantic foo.cpp 

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/20150204/0e8093bb/attachment.html>

More information about the llvm-bugs mailing list