[LLVMbugs] [Bug 13179] New: Need codegen + warnings + static analyzer support for alloc_size

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Jun 22 11:13:00 PDT 2012


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

             Bug #: 13179
           Summary: Need codegen + warnings + static analyzer support for
                    alloc_size
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: nunoplopes at sapo.pt
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


We need better support for the alloc_size attribute:
 - warnings  (to catch simple buffer overflow bugs like we do for static
arrays)
 - static analyzer (wire the attribute to the malloc analysis)
 - codegen:  We still need a new metadata type to represent this information.
Chris suggested creating a mini-expression language that could be used by debug
info as well.
An old codegen implementation was reverted in r159016
(http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120618/059495.html)



I've also proposed a new and more expressive attribute in
http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-June/022272.html.
The idea is to allow the following use cases:
char *my_strdup(char *str) __attribute__((alloc_size_ex(strlen(str)+1)));
void *my_complex_alloc(int n, int size, int add)  
__attribute__((alloc_size_ex(n * size + add)));
char *middle(int size) __attribute__((alloc_size_ex(size, size/2)));

first arg: size, 2nd: offset (or 0 by default)

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list