Run Microsoft Analyzer over dmd source code

Don nospam at nospam.com
Mon Aug 8 21:44:24 PDT 2011


David Nadlinger wrote:
> 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
Aargh, you're right.


More information about the Digitalmars-d mailing list