public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103896] New: Label as value: object destructor is not called
@ 2022-01-03  9:45 fchelnokov at gmail dot com
  2022-01-03 12:00 ` [Bug c++/103896] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: fchelnokov at gmail dot com @ 2022-01-03  9:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103896

            Bug ID: 103896
           Summary: Label as value: object destructor is not called
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

When executing this program:
```
#include <iostream>
struct NonTrivial {
    NonTrivial() { std::cout << "ctor "; }
    ~NonTrivial() { std::cout << "dtor "; }
};

int main() {
  int i = 0;
  start:
  NonTrivial object;
  goto *((i++ == 0) ? &&start : &&end);
  end:;
}
```
GCC prints: `ctor ctor dtor` meaning that the object was constructed twice but
destructed only once, which looks as a bug. Demo:
https://gcc.godbolt.org/z/aWdYx8ox4

Related discussion: https://stackoverflow.com/q/60812880/7325599

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/103896] Label as value: object destructor is not called
  2022-01-03  9:45 [Bug c++/103896] New: Label as value: object destructor is not called fchelnokov at gmail dot com
@ 2022-01-03 12:00 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-03 12:00 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103896

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of much older bug 37722.

*** This bug has been marked as a duplicate of bug 37722 ***

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-01-03 12:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-03  9:45 [Bug c++/103896] New: Label as value: object destructor is not called fchelnokov at gmail dot com
2022-01-03 12:00 ` [Bug c++/103896] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).