From: Jason Merrill <jason@redhat.com>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: Jonathan Wakely <jwakely@redhat.com>,
libstdc++@gcc.gnu.org,
gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: RFA (libstdc++): PATCH to implement C++17 over-aligned new
Date: Mon, 12 Sep 2016 21:13:00 -0000 [thread overview]
Message-ID: <CADzB+2=7frczYRC0Fi3MkX_X36uDDz1ho9RrELiOfEyeEcRwzg@mail.gmail.com> (raw)
In-Reply-To: <87oa3vwrkf.fsf@linux-m68k.org>
[-- Attachment #1: Type: text/plain, Size: 1242 bytes --]
I'm checking in this patch, which should fix the remaining issues:
On Sat, Sep 10, 2016 at 2:14 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> FAIL: g++.dg/cpp1z/aligned-new1.C (test for excess errors)
> Excess errors:
> /daten/aranym/gcc/gcc-20160910/gcc/testsuite/g++.dg/cpp1z/aligned-new1.C:10:20: warning: requested alignment 64 is larger than 16 [-Wattributes]
> FAIL: g++.dg/cpp1z/aligned-new1.C execution test
> FAIL: g++.dg/cpp1z/aligned-new4.C (test for warnings, line 11)
> FAIL: g++.dg/cpp1z/aligned-new4.C (test for excess errors)
> Excess errors:
> /daten/aranym/gcc/gcc-20160910/gcc/testsuite/g++.dg/cpp1z/aligned-new4.C:3:20: warning: requested alignment 64 is larger than 16 [-Wattributes]
> /daten/aranym/gcc/gcc-20160910/gcc/testsuite/g++.dg/cpp1z/aligned-new4.C:4:20: warning: requested alignment 64 is larger than 16 [-Wattributes]
> FAIL: g++.dg/cpp1z/aligned-new5.C -std=gnu++11 (test for excess errors)
> Excess errors:
> aligned-new5.C:(.text+0xe): undefined reference to `operator new(unsigned int, std::align_val_t)'
>
> Andreas.
>
> --
> Andreas Schwab, schwab@linux-m68k.org
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
[-- Attachment #2: align.diff --]
[-- Type: text/plain, Size: 2126 bytes --]
commit da8e3c2d6ca085aeb815d741e4d858b1216473a1
Author: Jason Merrill <jason@redhat.com>
Date: Mon Sep 12 15:01:06 2016 -0400
Fix aligned-new tests on m68k.
* c-common.c (check_cxx_fundamental_alignment_constraints): Fix
bit/byte confusion, allow large alignment for types.
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 16f6548..b4f4d10 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -7836,8 +7836,7 @@ check_user_alignment (const_tree align, bool allow_zero)
return i;
}
-/*
- If in c++-11, check if the c++-11 alignment constraint with respect
+/* If in c++-11, check if the c++-11 alignment constraint with respect
to fundamental alignment (in [dcl.align]) are satisfied. If not in
c++-11 mode, does nothing.
@@ -7862,7 +7861,7 @@ check_cxx_fundamental_alignment_constraints (tree node,
int flags)
{
bool alignment_too_large_p = false;
- unsigned requested_alignment = 1U << align_log;
+ unsigned requested_alignment = (1U << align_log) * BITS_PER_UNIT;
unsigned max_align = 0;
if ((!(flags & ATTR_FLAG_CXX11) && !warn_cxx_compat)
@@ -7906,15 +7905,19 @@ check_cxx_fundamental_alignment_constraints (tree node,
}
else if (TYPE_P (node))
{
- /* Let's be liberal for types. */
- if (requested_alignment > (max_align = BIGGEST_ALIGNMENT))
+ /* Let's be liberal for types. BIGGEST_ALIGNMENT is the largest
+ alignment a built-in type can require, MAX_OFILE_ALIGNMENT is the
+ largest alignment the object file can represent, but a type that is
+ only allocated dynamically could request even larger alignment. So
+ only limit type alignment to what TYPE_ALIGN can represent. */
+ if (requested_alignment > (max_align = 8U << 28))
alignment_too_large_p = true;
}
if (alignment_too_large_p)
pedwarn (input_location, OPT_Wattributes,
"requested alignment %d is larger than %d",
- requested_alignment, max_align);
+ requested_alignment / BITS_PER_UNIT, max_align / BITS_PER_UNIT);
return !alignment_too_large_p;
}
next prev parent reply other threads:[~2016-09-12 20:58 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-08 7:10 Jason Merrill
2016-09-08 8:32 ` Marc Glisse
2016-09-08 11:18 ` Jonathan Wakely
2016-09-09 21:40 ` Jason Merrill
2016-09-10 7:03 ` Christophe Lyon
2016-09-10 10:14 ` Marc Glisse
2016-09-10 10:35 ` Jonathan Wakely
2016-09-11 9:14 ` Christophe Lyon
2016-09-11 9:55 ` Jonathan Wakely
2016-09-11 9:56 ` Jonathan Wakely
2016-09-11 10:20 ` Christophe Lyon
2016-09-11 12:09 ` Jonathan Wakely
2016-09-13 13:04 ` Szabolcs Nagy
2016-09-10 10:14 ` Jonathan Wakely
2016-09-11 7:09 ` Andreas Schwab
2016-09-12 21:13 ` Jason Merrill [this message]
2016-09-13 8:41 ` Christophe Lyon
2016-09-13 12:37 ` Andreas Schwab
2016-09-13 12:54 ` Jason Merrill
2016-09-13 13:18 ` Andreas Schwab
2016-09-13 13:21 ` Jason Merrill
2016-09-14 12:13 ` Andreas Schwab
2016-09-14 16:11 ` Christophe Lyon
2016-09-14 16:37 ` Jason Merrill
2016-09-15 10:00 ` Rainer Orth
2016-09-15 12:23 ` Christophe Lyon
2016-09-15 20:09 ` Jason Merrill
2016-09-16 7:12 ` Rainer Orth
2016-09-16 8:15 ` Christophe Lyon
2016-09-16 9:14 ` Jonathan Wakely
2016-09-16 9:51 ` Marc Glisse
2016-09-16 11:12 ` Jonathan Wakely
2016-09-16 13:13 ` Jonathan Wakely
2016-09-16 13:17 ` Rainer Orth
2016-09-16 18:19 ` Jonathan Wakely
2016-09-12 14:15 ` Rainer Orth
2016-09-12 16:19 ` Jonathan Wakely
2016-09-12 18:57 ` Jason Merrill
2016-09-14 12:11 ` Rainer Orth
2016-09-08 11:00 ` Jonathan Wakely
2017-11-24 14:26 ` Marc Glisse
2017-11-29 21:23 ` Jason Merrill
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='CADzB+2=7frczYRC0Fi3MkX_X36uDDz1ho9RrELiOfEyeEcRwzg@mail.gmail.com' \
--to=jason@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jwakely@redhat.com \
--cc=libstdc++@gcc.gnu.org \
--cc=schwab@linux-m68k.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).