public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96721] New: [11 Regression] pseudo-destructor calls on pointers since r11-2238
@ 2020-08-20  9:22 jakub at gcc dot gnu.org
  2020-08-20  9:22 ` [Bug c++/96721] " jakub at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-08-20  9:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96721
           Summary: [11 Regression] pseudo-destructor calls on pointers
                    since r11-2238
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: needs-bisection, needs-reduction
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org, slyfox at gcc dot gnu.org,
                    unassigned at gcc dot gnu.org, webrown.cpp at gmail dot com
        Depends on: 96717
  Target Milestone: ---

+++ This bug was initially created as a clone of Bug #96717 +++

In

typedef int *T;

void
foo (T a)
{
  if (a)
    return;
  a.~T ();
}

int
main ()
{
  int p;
  foo (&p);
  foo (nullptr);
  return 0;
}

since r11-2238-ge443d8213864ac337c29092d4767224f280d2062 the pseudo-destructor
is emitted on what the pointer points to rather than on the pointer itself.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96717
[Bug 96717] -flifetime-dse=2 breaks webkit-gtk-2.28.4

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

* [Bug c++/96721] [11 Regression] pseudo-destructor calls on pointers since r11-2238
  2020-08-20  9:22 [Bug c++/96721] New: [11 Regression] pseudo-destructor calls on pointers since r11-2238 jakub at gcc dot gnu.org
@ 2020-08-20  9:22 ` jakub at gcc dot gnu.org
  2020-08-20  9:49 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-08-20  9:22 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-08-20
   Target Milestone|---                         |11.0
                 CC|                            |jason at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW

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

* [Bug c++/96721] [11 Regression] pseudo-destructor calls on pointers since r11-2238
  2020-08-20  9:22 [Bug c++/96721] New: [11 Regression] pseudo-destructor calls on pointers since r11-2238 jakub at gcc dot gnu.org
  2020-08-20  9:22 ` [Bug c++/96721] " jakub at gcc dot gnu.org
@ 2020-08-20  9:49 ` jakub at gcc dot gnu.org
  2020-08-20  9:49 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-08-20  9:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
More reduced testcase:

typedef int *T;

int
main ()
{
  T a = nullptr;
  a.~T ();
}

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

* [Bug c++/96721] [11 Regression] pseudo-destructor calls on pointers since r11-2238
  2020-08-20  9:22 [Bug c++/96721] New: [11 Regression] pseudo-destructor calls on pointers since r11-2238 jakub at gcc dot gnu.org
  2020-08-20  9:22 ` [Bug c++/96721] " jakub at gcc dot gnu.org
  2020-08-20  9:49 ` jakub at gcc dot gnu.org
@ 2020-08-20  9:49 ` jakub at gcc dot gnu.org
  2020-08-20 10:08 ` jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-08-20  9:49 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P1

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

* [Bug c++/96721] [11 Regression] pseudo-destructor calls on pointers since r11-2238
  2020-08-20  9:22 [Bug c++/96721] New: [11 Regression] pseudo-destructor calls on pointers since r11-2238 jakub at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-08-20  9:49 ` jakub at gcc dot gnu.org
@ 2020-08-20 10:08 ` jakub at gcc dot gnu.org
  2020-08-24 11:27 ` jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-08-20 10:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
build_trivial_dtor_call has:
  if (INDIRECT_TYPE_P (TREE_TYPE (instance)))
    {
      if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (instance))))
        goto no_clobber;
      instance = cp_build_fold_indirect_ref (instance);
    }
so, either we adjust the caller such that for TYPE_PTR_P types it passes an
address of the instance rather than the instance itself, or we add an argument
(perhaps defaulted bool) to build_trivial_dtor_call that inhibits this behavior
for TYPE_PTR_P, or drop this if completely and adjust any caller that calls it
with a pointer or reference and expects it to destruct what it points to rather
than itself.

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

* [Bug c++/96721] [11 Regression] pseudo-destructor calls on pointers since r11-2238
  2020-08-20  9:22 [Bug c++/96721] New: [11 Regression] pseudo-destructor calls on pointers since r11-2238 jakub at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-08-20 10:08 ` jakub at gcc dot gnu.org
@ 2020-08-24 11:27 ` jakub at gcc dot gnu.org
  2020-08-25  5:20 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-08-24 11:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 49110
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49110&action=edit
gcc11-pr96721.patch

Untested fix.

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

* [Bug c++/96721] [11 Regression] pseudo-destructor calls on pointers since r11-2238
  2020-08-20  9:22 [Bug c++/96721] New: [11 Regression] pseudo-destructor calls on pointers since r11-2238 jakub at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-08-24 11:27 ` jakub at gcc dot gnu.org
@ 2020-08-25  5:20 ` cvs-commit at gcc dot gnu.org
  2020-08-25 11:17 ` rguenth at gcc dot gnu.org
  2020-09-17 17:58 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-25  5:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:61680cfaf1eef26a5953f36ab82a1cc13f9b2f2c

commit r11-2831-g61680cfaf1eef26a5953f36ab82a1cc13f9b2f2c
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Tue Aug 25 07:19:41 2020 +0200

    c++: Fix up ptr.~PTR () handling [PR96721]

    The following testcase is miscompiled, because build_trivial_dtor_call
    handles the case when instance is a pointer by adding a clobber to what
    the pointer points to (which is desirable e.g. for delete) rather than the
    pointer itself.  That is I think always desirable behavior for references,
    but for pointers for the pseudo dtor case it is not.

    2020-08-25  Jakub Jelinek  <jakub@redhat.com>

            PR c++/96721
            * cp-tree.h (build_trivial_dtor_call): Add bool argument defaulted
            to false.
            * call.c (build_trivial_dtor_call): Add NO_PTR_DEREF argument.  If
            instance is a pointer and NO_PTR_DEREF is true, clobber the pointer
            rather than what it points to.
            * semantics.c (finish_call_expr): Call build_trivial_dtor_call with
            true as NO_PTR_DEREF.

            * g++.dg/opt/flifetime-dse8.C: New test.

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

* [Bug c++/96721] [11 Regression] pseudo-destructor calls on pointers since r11-2238
  2020-08-20  9:22 [Bug c++/96721] New: [11 Regression] pseudo-destructor calls on pointers since r11-2238 jakub at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2020-08-25  5:20 ` cvs-commit at gcc dot gnu.org
@ 2020-08-25 11:17 ` rguenth at gcc dot gnu.org
  2020-09-17 17:58 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-08-25 11:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

* [Bug c++/96721] [11 Regression] pseudo-destructor calls on pointers since r11-2238
  2020-08-20  9:22 [Bug c++/96721] New: [11 Regression] pseudo-destructor calls on pointers since r11-2238 jakub at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2020-08-25 11:17 ` rguenth at gcc dot gnu.org
@ 2020-09-17 17:58 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-09-17 17:58 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96721
Bug 96721 depends on bug 96722, which changed state.

Bug 96722 Summary: [8/9 Regression] Clobbers on NULL since r8-1519
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96722

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

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

end of thread, other threads:[~2020-09-17 17:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-20  9:22 [Bug c++/96721] New: [11 Regression] pseudo-destructor calls on pointers since r11-2238 jakub at gcc dot gnu.org
2020-08-20  9:22 ` [Bug c++/96721] " jakub at gcc dot gnu.org
2020-08-20  9:49 ` jakub at gcc dot gnu.org
2020-08-20  9:49 ` jakub at gcc dot gnu.org
2020-08-20 10:08 ` jakub at gcc dot gnu.org
2020-08-24 11:27 ` jakub at gcc dot gnu.org
2020-08-25  5:20 ` cvs-commit at gcc dot gnu.org
2020-08-25 11:17 ` rguenth at gcc dot gnu.org
2020-09-17 17:58 ` jakub 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).