[LLVMbugs] [Bug 21124] New: G++'s __builtin___sprintf_chk() warns on more uses than clang's

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Oct 1 14:06:27 PDT 2014


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

            Bug ID: 21124
           Summary: G++'s __builtin___sprintf_chk() warns on more uses
                    than clang's
           Product: clang
           Version: unspecified
          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, nlewycky at google.com,
                    srhines at google.com
    Classification: Unclassified

G++ produces a warning for the following sample, whereas clang does not:

    $ cat foo.cpp
    int main() {
      char buf[5];
      __builtin___sprintf_chk(buf, 0, __builtin_object_size(buf, 0), "%s",
"foobar");
    }
    $ g++ foo.cpp
    warning: call to int __builtin___sprintf_chk(char*, int, long unsigned int,
const char*, ...) will always overflow destination buffer [enabled by default]
       __builtin___sprintf_chk(buf, 0, __builtin_object_size(buf, 0), "%s",
"foobar");
    $ clang++ 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/20141001/f9508369/attachment.html>


More information about the llvm-bugs mailing list