[llvm-bugs] [Bug 47810] New: format string checker should apply to indirect function calls

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 12 14:39:10 PDT 2020


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

            Bug ID: 47810
           Summary: format string checker should apply to indirect
                    function calls
           Product: clang
           Version: 10.0
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: llvm at insonuit.org
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

The format string checker operates on direct function calls, but not indirect
function calls.  Thus the following examples generates 2 warnings, not 3:

#include <stdio.h>

extern int notind(char *f, ...) __attribute__((__format__(printf, 1, 2)));
extern int (*ind)(char *f, ...) __attribute__((__format__(printf, 1, 2)));

int main(void)
{
  printf("%d", "no");
  notind("%d", "no");
  (*ind)("%d", "no");
}

It would be useful if indirect function calls could be checked as well.  I
tested on clang 6.0 and clang 10.0 (the builds I had at hand) but don't see any
relevant changes in trunk.  Interestingly, gcc 9.3 does check indirect calls.

-- 
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/20201012/c91906e7/attachment.html>


More information about the llvm-bugs mailing list