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

Anna Zaks ganna at apple.com
Fri Sep 7 15:19:53 PDT 2012


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;
}

Anna.



More information about the cfe-commits mailing list