public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/98130] [11 regression] placement new fails on webkit-gtk-2.28.4 since r11-4745-g58c9de46541ade79
Date: Fri, 04 Dec 2020 12:25:03 +0000	[thread overview]
Message-ID: <bug-98130-4-eXougO7pfl@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98130-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #4)
> That would mean:
> 
> --- gcc/testsuite/g++.dg/opt/pr98130.C.jj	2020-12-04 12:30:11.510988404 +0100
> +++ gcc/testsuite/g++.dg/opt/pr98130.C	2020-12-04 12:33:05.663028984 +0100
> @@ -0,0 +1,25 @@
> +// PR c++/98130
> +// { dg-do run { target c++11 } }
> +// { dg-options "-O2" }
> +
> +#include <new>
> +
> +typedef int *T;
> +
> +static unsigned char storage[sizeof (T)] alignas (T);
> +static T *p = (T *) storage;
> +
> +static inline __attribute__((__always_inline__)) void
> +foo (T value)
> +{
> +  new (p) T(value);
> +}
> +
> +int
> +main ()
> +{
> +  int a;
> +  foo (&a);
> +  if (!*p)
> +    __builtin_abort ();
> +}
> --- gcc/gimple.c.jj	2020-11-26 01:14:47.528081989 +0100
> +++ gcc/gimple.c	2020-12-04 12:34:44.865911907 +0100
> @@ -1514,11 +1514,12 @@ gimple_call_fnspec (const gcall *stmt)
>       such operator, then we can treat it as free.  */
>    if (fndecl
>        && DECL_IS_OPERATOR_DELETE_P (fndecl)
> +      && DECL_IS_REPLACEABLE_OPERATOR (fndecl)
>        && gimple_call_from_new_or_delete (stmt))
>      return ".co ";
>    /* Similarly operator new can be treated as malloc.  */
>    if (fndecl
> -      && DECL_IS_OPERATOR_NEW_P (fndecl)
> +      && DECL_IS_REPLACEABLE_OPERATOR_NEW_P (fndecl)
>        && gimple_call_from_new_or_delete (stmt))
>      return "mC";
>    return "";
> 
> but the testcase is miscompiled even with that change, and we don't really
> return ".co " nor "mC" on the testcase.

The fix works for me?  Note I think we don't need the extra check on
the delete case.

  parent reply	other threads:[~2020-12-04 12:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-03 20:45 [Bug c++/98130] New: [11 regression] placement new fails on webkit-gtk-2.28.4 slyfox at gcc dot gnu.org
2020-12-04  6:54 ` [Bug c++/98130] [11 regression] placement new fails on webkit-gtk-2.28.4 since r11-4745-g58c9de46541ade79 marxin at gcc dot gnu.org
2020-12-04  7:19 ` rguenth at gcc dot gnu.org
2020-12-04 11:27 ` jakub at gcc dot gnu.org
2020-12-04 11:37 ` jakub at gcc dot gnu.org
2020-12-04 11:59 ` hubicka at ucw dot cz
2020-12-04 12:21 ` rguenth at gcc dot gnu.org
2020-12-04 12:25 ` rguenth at gcc dot gnu.org [this message]
2020-12-04 12:33 ` jakub at gcc dot gnu.org
2020-12-04 12:37 ` marxin at gcc dot gnu.org
2020-12-04 12:48 ` jakub at gcc dot gnu.org
2020-12-04 13:33 ` rguenth at gcc dot gnu.org
2020-12-04 18:11 ` cvs-commit at gcc dot gnu.org
2020-12-04 18:12 ` jakub at gcc dot gnu.org
2020-12-04 19:49 ` slyfox at gcc dot gnu.org
2020-12-22 19:09 ` jason at gcc dot gnu.org
2021-01-19 11:59 ` rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-98130-4-eXougO7pfl@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).