Run Microsoft Analyzer over dmd source code

David Nadlinger see at klickverbot.at
Mon Aug 8 21:28:26 PDT 2011


On 8/9/11 5:46 AM, Don wrote:
>> Don:
>>
>>> I think these are false positives too. The ones I saw were of the form: […]
> 4995: FuncDeclaration *fd;
> 4996: Expression *pthis = NULL;
> 4997: if (deleg->op == TOKdelegate)
> 4998: {
> 4999: fd = ((DelegateExp *)deleg)->func;
> 5000: pthis = ((DelegateExp *)deleg)->e1;
> 5001: }
> 5002: else if (deleg->op == TOKfunction)
> 5003: fd = ((FuncExp*)deleg)->fd;
> 5004:
> 5005: assert(fd && fd->fbody);
>
> warning C6001: Using uninitialized memory 'fd': Lines: 4995, 4996, 4997,
> 5002, 5005

If deleg->op isn't guaranteed to be either TOKdelegate or TOKfunction, 
this is indeed a bug because fd contains garbage otherwise (you don't 
nullptr-initialize it).

David


More information about the Digitalmars-d mailing list