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

Diego Novillo dnovillo at google.com
Fri May 15 05:18:44 PDT 2015


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.



More information about the cfe-commits mailing list