public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/102772] [12 regression] g++.dg/torture/pr80334.C FAILs
Date: Thu, 31 Mar 2022 14:49:08 +0000	[thread overview]
Message-ID: <bug-102772-4-SUYMhj7IIe@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102772-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #41 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #39)
> (In reply to ro@CeBiTec.Uni-Bielefeld.DE from comment #37)
> >   AFAICS, alignof is C++ >= 11 only.  I've used the attached patch to
> >   use __alignof__ instead, although I don't know if that's the best fix.
> 
> Yes, alignof is C++11 only, but the reason it's OK to use there is that
> __STDCPP_DEFAULT_NEW_ALIGNMENT__ is C++17 only, and alignof is guarded by:
> 
> #if __cpp_aligned_new
>         if (alignof(_Tp) > __STDCPP_DEFAULT_NEW_ALIGNMENT__)
> 
> Strictly speaking, this code is enabled when -faligned-new is active, which
> is true for C++17 by default.
> 
> It appears that Jakub's patch makes -faligned-new always active for Solaris
> x86, which we don't want.

Ah, indeed, I thought the threshold is separate from it being enabled, but it
is not.
So, we want to change it in the option override handling only if cxx_dialect >=
cxx17, but that is something only defined in c-family, while the backend option
overriding is in code linked with all FEs.
Thus, we'd need to override it instead somewhere in i386-c.cc.
But nothing in that file is called early enough, from what I can see, the
sequence of initialization is:
cxx_dialect set to the default (cxx17 now)
possibly cxx_dialect changed if -std= used on command line
SUBTARGET_OVERRIDE_OPTIONS invoked
cxx_init_decl_processing
4645      if (aligned_new_threshold == -1)
4646        aligned_new_threshold = (cxx_dialect >= cxx17) ? 1 : 0;
4647      if (aligned_new_threshold == 1)
4648        aligned_new_threshold = malloc_alignment () / BITS_PER_UNIT;
code invoked
ix86_register_pragmas from i386-c.cc called
ix86_target_macros from i386-c.cc called

Also, the -Waligned-new= warning uses malloc_alignment () rather than
aligned_new_threshold, so if we want to override something for 32-bit x86
solaris, mingw and vxworks, we probably need something to hook into
malloc_alignment rather than to tweak aligned_new_threshold.

I think we need a target macro for it though rather than target hook, because
it needs to be invoked from the C++ FE and implemented in config/*-c.cc

  parent reply	other threads:[~2022-03-31 14:49 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-15 11:39 [Bug target/102772] New: " ro at gcc dot gnu.org
2021-10-15 11:40 ` [Bug target/102772] " ro at gcc dot gnu.org
2021-10-15 11:40 ` ro at gcc dot gnu.org
2021-10-15 11:40 ` ro at gcc dot gnu.org
2021-10-15 12:06 ` hjl.tools at gmail dot com
2021-10-15 13:02 ` rguenth at gcc dot gnu.org
2021-10-15 14:29 ` ro at CeBiTec dot Uni-Bielefeld.DE
2021-10-15 20:44 ` hjl.tools at gmail dot com
2021-11-16 11:51 ` jakub at gcc dot gnu.org
2021-11-23 12:36 ` ro at gcc dot gnu.org
2022-03-17 15:05 ` jakub at gcc dot gnu.org
2022-03-17 15:14 ` ro at CeBiTec dot Uni-Bielefeld.DE
2022-03-21 11:44 ` jakub at gcc dot gnu.org
2022-03-21 12:01 ` ro at CeBiTec dot Uni-Bielefeld.DE
2022-03-21 12:03 ` ro at gcc dot gnu.org
2022-03-21 12:03 ` ro at gcc dot gnu.org
2022-03-21 13:17 ` jakub at gcc dot gnu.org
2022-03-21 13:31 ` jakub at gcc dot gnu.org
2022-03-22 15:12 ` ro at CeBiTec dot Uni-Bielefeld.DE
2022-03-22 17:00 ` jakub at gcc dot gnu.org
2022-03-23 13:56 ` ro at CeBiTec dot Uni-Bielefeld.DE
2022-03-23 14:11 ` jakub at gcc dot gnu.org
2022-03-23 14:17 ` jakub at gcc dot gnu.org
2022-03-25 12:48 ` ro at CeBiTec dot Uni-Bielefeld.DE
2022-03-25 12:53 ` ro at CeBiTec dot Uni-Bielefeld.DE
2022-03-25 12:54 ` jakub at gcc dot gnu.org
2022-03-25 13:00 ` ro at CeBiTec dot Uni-Bielefeld.DE
2022-03-25 13:06 ` jakub at gcc dot gnu.org
2022-03-25 13:13 ` ro at CeBiTec dot Uni-Bielefeld.DE
2022-03-25 13:18 ` jakub at gcc dot gnu.org
2022-03-25 13:22 ` ro at gcc dot gnu.org
2022-03-25 13:49 ` jakub at gcc dot gnu.org
2022-03-30 14:06 ` cvs-commit at gcc dot gnu.org
2022-03-30 14:45 ` jakub at gcc dot gnu.org
2022-03-30 14:52 ` redi at gcc dot gnu.org
2022-03-30 14:56 ` redi at gcc dot gnu.org
2022-03-30 15:04 ` redi at gcc dot gnu.org
2022-03-30 15:13 ` redi at gcc dot gnu.org
2022-03-30 15:23 ` jakub at gcc dot gnu.org
2022-03-31 13:46 ` ro at CeBiTec dot Uni-Bielefeld.DE
2022-03-31 13:47 ` ro at gcc dot gnu.org
2022-03-31 14:16 ` redi at gcc dot gnu.org
2022-03-31 14:18 ` redi at gcc dot gnu.org
2022-03-31 14:49 ` jakub at gcc dot gnu.org [this message]
2022-03-31 15:15 ` redi at gcc dot gnu.org
2022-03-31 15:47 ` jakub at gcc dot gnu.org
2022-04-04 11:54 ` jakub at gcc dot gnu.org
2022-04-11  9:13 ` jakub at gcc dot gnu.org
2022-04-11 14:19 ` ro at CeBiTec dot Uni-Bielefeld.DE
2022-04-11 14:19 ` ro at CeBiTec dot Uni-Bielefeld.DE
2022-04-11 15:29 ` jakub at gcc dot gnu.org
2022-04-12  7:53 ` jakub at gcc dot gnu.org
2022-04-13 14:47 ` ro at CeBiTec dot Uni-Bielefeld.DE
2022-05-06  8:31 ` [Bug target/102772] [12/13 " jakub at gcc dot gnu.org
2023-05-08 12:22 ` [Bug target/102772] [12/13/14 " 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-102772-4-SUYMhj7IIe@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).