[Bug c++/82818] Bad Codegen, delete does not check for nullptrs

2017-11-03 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82818

--- Comment #5 from Jonathan Wakely  ---
(In reply to dark_sylinc from comment #0)
>  * AFAIK it is legal to call the destructor.

Only if you have ensured it won't be called implicitly, e.g. by creating it on
the heap. Your object is an automatic (stack) variable, so gets destroyed three
times in total, which is so invalid it hurts.

[Bug c++/82818] Bad Codegen, delete does not check for nullptrs

2017-11-03 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82818

Richard Biener  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #4 from Richard Biener  ---
INvalid.

[Bug c++/82818] Bad Codegen, delete does not check for nullptrs

2017-11-03 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82818

--- Comment #3 from Marc Glisse  ---
Please read the documentation for -flifetime-dse, your code is invalid.

[Bug c++/82818] Bad Codegen, delete does not check for nullptrs

2017-11-02 Thread dark_sylinc at yahoo dot com.ar
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82818

--- Comment #2 from dark_sylinc at yahoo dot com.ar ---
Created attachment 42540
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=42540=edit
Workaround. Uncomment "//a.~FastArray();" to make the crash come back

[Bug c++/82818] Bad Codegen, delete does not check for nullptrs

2017-11-02 Thread dark_sylinc at yahoo dot com.ar
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82818

--- Comment #1 from dark_sylinc at yahoo dot com.ar ---
Update:

1. Confirmed to be broken with gcc 7.2
2. When I said fsanitize; I meant fsanitize=undefined
3. When code is slightly modified as in the new attachment, the crash is gone.
But it appears again if after calling a.destroy(); we add a.~FastArray();