public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* C++ PATCH for c++/66216 (ICE with aligned attribute)
@ 2015-06-26 21:56 Jason Merrill
  0 siblings, 0 replies; only message in thread
From: Jason Merrill @ 2015-06-26 21:56 UTC (permalink / raw)
  To: gcc-patches List

[-- Attachment #1: Type: text/plain, Size: 214 bytes --]

We weren't properly propagating the alignment to other variants after 
applying it, so we ended up with two const-qualified variants with 
different alignment.

Tested x86_64-pc-linux-gnu, applying to trunk and 5.

[-- Attachment #2: 66216.patch --]
[-- Type: text/x-patch, Size: 1165 bytes --]

commit ffea563209dfc6daf1054fffc6f8d726e440f1dc
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Jun 26 16:52:01 2015 -0400

    	PR c++/66216
    	* class.c (finish_struct): Call fixup_attribute_variants.

diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index f4e4f85..be31de2 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -6820,6 +6820,7 @@ finish_struct (tree t, tree attributes)
   unreverse_member_declarations (t);
 
   cplus_decl_attributes (&t, attributes, (int) ATTR_FLAG_TYPE_IN_PLACE);
+  fixup_attribute_variants (t);
 
   /* Nadger the current location so that diagnostics point to the start of
      the struct, not the end.  */
diff --git a/gcc/testsuite/g++.dg/ext/attrib52.C b/gcc/testsuite/g++.dg/ext/attrib52.C
new file mode 100644
index 0000000..e33556c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attrib52.C
@@ -0,0 +1,15 @@
+// PR c++/66216
+// { dg-do compile { target c++11 } }
+// { dg-options "" }
+
+class CMymy
+{
+  unsigned char _a;
+  unsigned char _b;
+public:
+  constexpr CMymy() : _a(), _b() {}
+
+  constexpr CMymy(const CMymy &) = default;
+  CMymy &operator=(const CMymy &) = default;
+
+} __attribute__((aligned(2)));

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-06-26 21:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-26 21:56 C++ PATCH for c++/66216 (ICE with aligned attribute) Jason Merrill

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).