diff mbox

RFA (libstdc++): PATCH to implement C++17 over-aligned new

Message ID CADzB+2m99CQABVSVmm3H8ZYpF1sNBkwxmrZnHVtgAeE49KEpfQ@mail.gmail.com
State New
Headers show

Commit Message

Jason Merrill Sept. 13, 2016, 12:48 p.m. UTC
Does this help?

On Tue, Sep 13, 2016 at 8:32 AM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> On Sep 12 2016, Jason Merrill <jason@redhat.com> wrote:
>
>> I'm checking in this patch, which should fix the remaining issues:
>
> Unfortunatly that breaks a few other tests:
>
> FAIL: g++.dg/cpp0x/alignas5.C  -std=c++11 (test for excess errors)
> FAIL: g++.dg/cpp0x/alignas5.C  -std=c++14 (test for excess errors)
> FAIL: g++.dg/cpp0x/gen-attrs-21.C  -std=c++11 (test for excess errors)
> FAIL: g++.dg/cpp0x/gen-attrs-21.C  -std=c++14 (test for excess errors)
> FAIL: g++.dg/cpp0x/gen-attrs-51.C  -std=c++11 (test for excess errors)
> FAIL: g++.dg/cpp0x/gen-attrs-51.C  -std=c++14 (test for excess errors)
> FAIL: g++.dg/cpp0x/gen-attrs-54.C  -std=c++11 (test for excess errors)
> FAIL: g++.dg/cpp0x/gen-attrs-54.C  -std=c++14 (test for excess errors)
> FAIL: g++.dg/ipa/devirt-33.C   (test for excess errors)
> FAIL: g++.dg/lookup/name-clash11.C  -std=gnu++11 (test for excess errors)
> FAIL: g++.dg/lookup/name-clash11.C  -std=gnu++14 (test for excess errors)
> FAIL: g++.dg/pr67989.C   (test for excess errors)
>
> They all fail with "warning: requested alignment %d is larger than 2
> [-Wattributes]".
>
> 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."
commit 113f925a58a37cb8f18cd9c7aeeb4c03f5fc6afe
Author: Jason Merrill <jason@redhat.com>
Date:   Tue Sep 13 08:46:06 2016 -0400

            * c-common.c (check_cxx_fundamental_alignment_constraints): Use
            unsigned HOST_WIDE_INT.

Comments

Andreas Schwab Sept. 13, 2016, 1:03 p.m. UTC | #1
On Sep 13 2016, Jason Merrill <jason@redhat.com> wrote:

> Does this help?

Unfortunatly no.

Andreas.
diff mbox

Patch

diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 9b5e016..e3dc0f5 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -7861,8 +7861,9 @@  check_cxx_fundamental_alignment_constraints (tree node,
 					     int flags)
 {
   bool alignment_too_large_p = false;
-  unsigned requested_alignment = (1U << align_log) * BITS_PER_UNIT;
-  unsigned max_align = 0;
+  unsigned HOST_WIDE_INT requested_alignment
+    = (unsigned HOST_WIDE_INT)BITS_PER_UNIT << align_log;
+  unsigned HOST_WIDE_INT max_align = 0;
 
   if ((!(flags & ATTR_FLAG_CXX11) && !warn_cxx_compat)
       || (node == NULL_TREE || node == error_mark_node))
@@ -7910,14 +7911,15 @@  check_cxx_fundamental_alignment_constraints (tree node,
 	 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))
+      if (requested_alignment > (max_align = (unsigned HOST_WIDE_INT)8 << 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 / BITS_PER_UNIT, max_align / BITS_PER_UNIT);
+	     int(requested_alignment / BITS_PER_UNIT),
+	     int(max_align / BITS_PER_UNIT));
 
   return !alignment_too_large_p;
 }