[cfe-commits] r163407 - in /cfe/trunk: lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp test/Analysis/malloc-sizeof.c

Jordan Rose jordan_rose at apple.com
Fri Sep 7 15:20:46 PDT 2012


On Sep 7, 2012, at 15:19 , Anna Zaks <ganna at apple.com> wrote:

> 
> On Sep 7, 2012, at 2:13 PM, Jordan Rose <jordan_rose at apple.com> wrote:
> 
>> 
>> On Sep 7, 2012, at 12:20 , Anna Zaks <ganna at apple.com> wrote:
>> 
>>> +          // For now, let's only reason about arrays of built in types.
>>> +          if (!ElemType->isBuiltinType())
>>> +            continue;
>> 
>> Why this exception? It seems to me like arrays of user-defined types will make this warning almost always valid, since you can't allocate extra space for each element. Is there a specific case you're trying to handle here?
> 
> int *mallocArraySize() {
>  static const int nestedTable[10][10];
>  int *table1 = malloc(sizeof nestedTable);
>  return table;
> }

Ah, pointers are not built-in types either. I see. Thanks!



More information about the cfe-commits mailing list