[llvm-bugs] [Bug 34575] New: __attribute__((__format__(printf()))) doesn't warn about NULL format string

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Sep 12 06:17:22 PDT 2017


https://bugs.llvm.org/show_bug.cgi?id=34575

            Bug ID: 34575
           Summary: __attribute__((__format__(printf()))) doesn't warn
                    about NULL format string
           Product: clang
           Version: 5.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: shabbyx at gmail.com
                CC: llvm-bugs at lists.llvm.org

Take this code:

    #include <stdio.h>

    int main()
    {
      printf(NULL, "x");
      return 0;
    }

gcc helpfully warns that:

    <source>: In function 'int main()':
    5 : <source>:5:19: warning: null argument where non-null required (argument
1) [-Wnonnull]
       printf(NULL, "x");
                   ^
    5 : <source>:5:19: warning: too many arguments for format
[-Wformat-extra-args]

while clang doesn't say anything (it doesn't even warn about extra arguments).
It would be nice if it did.

-- 
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/20170912/16105f88/attachment.html>


More information about the llvm-bugs mailing list