Segmentation fault with your recent new[]/delete[] warning patch

Ismail Pazarbasi ismail.pazarbasi at gmail.com
Fri May 15 06:14:06 PDT 2015


On Fri, May 15, 2015 at 2:18 PM, Diego Novillo <dnovillo at google.com> wrote:
> On Fri, May 15, 2015 at 5:31 AM, Ismail Pazarbasi
> <ismail.pazarbasi at gmail.com> wrote:
>> Reduced test case:
>>   struct C { };
>>
>>   struct A {
>>     C *p;
>>     A() : p{nullptr} { }
>>     ~A() { delete p; }
>>   };
>>
>> This is an oversight. I will fix it by replacing:
>>   return dyn_cast<const CXXNewExpr>(E);
>> with:
>>   return dyn_cast_or_null<const CXXNewExpr>(E);
>
> Great. My reduce job ended up with something similar:
>
> class Cord;
> class A {
>   A(const A &);
>   Cord *saved_cord_{nullptr};
> };
> A::A(const A &) { delete saved_cord_; }
>
> Are you going to add it to the testsuite together with your patch, or
> do you want me to add it first?
>
>
> Thanks.  Diego.

I think it's better that I add it with updated patch.

Thank you.



More information about the cfe-commits mailing list