public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104007] New: new (std::nothrow) S[n] always calls ~S
@ 2022-01-13 14:12 sbergman at redhat dot com
  2022-01-13 14:17 ` [Bug c++/104007] [12 Regression] new (std::nothrow) S[n] always calls ~S since r12-6328-gbeaee0a871b6485d marxin at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: sbergman at redhat dot com @ 2022-01-13 14:12 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 104007
           Summary: new (std::nothrow) S[n] always calls ~S
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sbergman at redhat dot com
  Target Milestone: ---

Apparently a recent regression on GCC trunk:

> $ cat test.cc
> #include <cstdlib>
> #include <new>
> struct S { ~S() { std::abort(); } };
> int main() {
>     new (std::nothrow) S[1];
> }

> $ g++ test.cc
> $ ./a.out
> Aborted (core dumped)

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

* [Bug c++/104007] [12 Regression] new (std::nothrow) S[n] always calls ~S since r12-6328-gbeaee0a871b6485d
  2022-01-13 14:12 [Bug c++/104007] New: new (std::nothrow) S[n] always calls ~S sbergman at redhat dot com
@ 2022-01-13 14:17 ` marxin at gcc dot gnu.org
  2022-01-13 14:18 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-01-13 14:17 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|new (std::nothrow) S[n]     |[12 Regression] new
                   |always calls ~S             |(std::nothrow) S[n] always
                   |                            |calls ~S since
                   |                            |r12-6328-gbeaee0a871b6485d
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-01-13
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r12-6328-gbeaee0a871b6485d.

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

* [Bug c++/104007] [12 Regression] new (std::nothrow) S[n] always calls ~S since r12-6328-gbeaee0a871b6485d
  2022-01-13 14:12 [Bug c++/104007] New: new (std::nothrow) S[n] always calls ~S sbergman at redhat dot com
  2022-01-13 14:17 ` [Bug c++/104007] [12 Regression] new (std::nothrow) S[n] always calls ~S since r12-6328-gbeaee0a871b6485d marxin at gcc dot gnu.org
@ 2022-01-13 14:18 ` rguenth at gcc dot gnu.org
  2022-01-17 20:32 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-13 14:18 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
   Target Milestone|---                         |12.0
           Priority|P3                          |P1

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

* [Bug c++/104007] [12 Regression] new (std::nothrow) S[n] always calls ~S since r12-6328-gbeaee0a871b6485d
  2022-01-13 14:12 [Bug c++/104007] New: new (std::nothrow) S[n] always calls ~S sbergman at redhat dot com
  2022-01-13 14:17 ` [Bug c++/104007] [12 Regression] new (std::nothrow) S[n] always calls ~S since r12-6328-gbeaee0a871b6485d marxin at gcc dot gnu.org
  2022-01-13 14:18 ` rguenth at gcc dot gnu.org
@ 2022-01-17 20:32 ` jason at gcc dot gnu.org
  2022-01-18 17:43 ` cvs-commit at gcc dot gnu.org
  2022-01-18 17:52 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2022-01-17 20:32 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jason at gcc dot gnu.org

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

* [Bug c++/104007] [12 Regression] new (std::nothrow) S[n] always calls ~S since r12-6328-gbeaee0a871b6485d
  2022-01-13 14:12 [Bug c++/104007] New: new (std::nothrow) S[n] always calls ~S sbergman at redhat dot com
                   ` (2 preceding siblings ...)
  2022-01-17 20:32 ` jason at gcc dot gnu.org
@ 2022-01-18 17:43 ` cvs-commit at gcc dot gnu.org
  2022-01-18 17:52 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-18 17:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:7ca21601704c4a637f3cefa7c8814920782354d8

commit r12-6694-g7ca21601704c4a637f3cefa7c8814920782354d8
Author: Jason Merrill <jason@redhat.com>
Date:   Mon Jan 17 17:08:03 2022 -0500

    c++: new (nothrow) array cleanup [PR104007]

    For this testcase, the cleanup that is supposed to happen if initialization
    throws was wrongly being run on the normal control path as well.  This
turns
    out to be because the EH-only handling in gimple_push_cleanup didn't apply
    to conditional cleanups such as we have for nothrow new, since we check
    whether the result is non-null before proceeding with the initialization.

            PR c++/104007

    gcc/ChangeLog:

            * gimplify.cc (gimple_push_cleanup): Handle eh_only in conditional
            context.

    gcc/testsuite/ChangeLog:

            * g++.dg/eh/new2.C: New test.

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

* [Bug c++/104007] [12 Regression] new (std::nothrow) S[n] always calls ~S since r12-6328-gbeaee0a871b6485d
  2022-01-13 14:12 [Bug c++/104007] New: new (std::nothrow) S[n] always calls ~S sbergman at redhat dot com
                   ` (3 preceding siblings ...)
  2022-01-18 17:43 ` cvs-commit at gcc dot gnu.org
@ 2022-01-18 17:52 ` jason at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2022-01-18 17:52 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2022-01-18 17:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13 14:12 [Bug c++/104007] New: new (std::nothrow) S[n] always calls ~S sbergman at redhat dot com
2022-01-13 14:17 ` [Bug c++/104007] [12 Regression] new (std::nothrow) S[n] always calls ~S since r12-6328-gbeaee0a871b6485d marxin at gcc dot gnu.org
2022-01-13 14:18 ` rguenth at gcc dot gnu.org
2022-01-17 20:32 ` jason at gcc dot gnu.org
2022-01-18 17:43 ` cvs-commit at gcc dot gnu.org
2022-01-18 17:52 ` jason 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).