[Bug c++/103843] Direct call to Desctructor is optimized out

2021-12-27 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103843 --- Comment #8 from Jonathan Wakely --- (In reply to Jonathan Wakely from comment #7) > Also, this is an automatic (i.e. stack) variable, so the destructor will run > at the end of the block, meaning it will be settled twice. Sorry, auto-corre

[Bug c++/103843] Direct call to Desctructor is optimized out

2021-12-27 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103843 --- Comment #7 from Jonathan Wakely --- Also, this is an automatic (i.e. stack) variable, so the destructor will run at the end of the block, meaning it will be settled twice. So another form of undefined behaviour. The program is just broken, i

[Bug c++/103843] Direct call to Desctructor is optimized out

2021-12-27 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103843 Jakub Jelinek changed: What|Removed |Added Resolution|FIXED |INVALID CC|

[Bug c++/103843] Direct call to Desctructor is optimized out

2021-12-27 Thread georgii.shagov--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103843 Georgii.Shagov changed: What|Removed |Added Resolution|INVALID |FIXED --- Comment #5 from Georgii.Shag

[Bug c++/103843] Direct call to Desctructor is optimized out

2021-12-27 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103843 Andrew Pinski changed: What|Removed |Added Resolution|FIXED |INVALID --- Comment #4 from Andrew Pins

[Bug c++/103843] Direct call to Desctructor is optimized out

2021-12-27 Thread georgii.shagov--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103843 Georgii.Shagov changed: What|Removed |Added Resolution|INVALID |FIXED --- Comment #3 from Georgii.Shag

[Bug c++/103843] Direct call to Desctructor is optimized out

2021-12-27 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103843 Andrew Pinski changed: What|Removed |Added Resolution|--- |INVALID Status|UNCONFIRMED

[Bug c++/103843] Direct call to Desctructor is optimized out

2021-12-27 Thread georgii.shagov--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103843 --- Comment #1 from Georgii.Shagov --- >From experiments, I would guess that in case of -O3 the call to destructor was substituted by initializer: This works fine: cat ./d.cpp #include class S { public: S() : i{1} {} ~S() { i=0; } v