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

            Bug ID: 117827
           Summary: Incorrect destructor calls after array-new-expression
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: daniel.grunwald at gmail dot com
  Target Milestone: ---

Created attachment 59736
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59736&action=edit
Test code

Starting with gcc-12, the following code is miscompiled (duplicate destructor
calls, causing use-after-free): https://godbolt.org/z/3GTd4vYTj (also attached)

If a C constructor throws, the previously already initialized array elements
need to be destroyed; but once the array is completely initialized and the
new-expression has completed, other exceptions later in the full expression
should not call any C destructors.

Reply via email to