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: unassignedclangb...@nondot.org
          Reporter: l...@insonuit.org
                CC: htmldevelo...@gmail.com, llvm-bugs@lists.llvm.org,
                    neeil...@live.com, richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to