This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RFA (c-common): PATCH to handle_aligned_attribute for debug/43370
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 05 May 2010 12:25:29 -0400
- Subject: RFA (c-common): PATCH to handle_aligned_attribute for debug/43370
My patch for PR 35315 changed decl_attributes to keep
ATTR_FLAG_TYPE_IN_PLACE even when dealing with a decl if that decl is
the naming TYPE_DECL for its type, but I didn't update
handle_aligned_attribute to deal properly with this situation. This
patch changes that the latter function to respect the flag if it is set.
I looked at the other handle_*_attribute functions in c-common, but it
doesn't seem that any others need this change.
Tested x86_64-pc-linux-gnu. OK for trunk, 4.4 and 4.5?
commit 8d541f29892c36be2d6906904ca0e0a32c672cdb
Author: Jason Merrill <jason@redhat.com>
Date: Tue May 4 21:47:31 2010 -0400
PR debug/43370
* c-common.c (handle_aligned_attribute): Respect
ATTR_FLAG_TYPE_IN_PLACE.
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 1718344..2f8d779 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -6692,10 +6692,12 @@ handle_aligned_attribute (tree *node, tree ARG_UNUSED (name), tree args,
}
else if (is_type)
{
+ if ((flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
+ /* OK, modify the type in place. */;
/* If we have a TYPE_DECL, then copy the type, so that we
don't accidentally modify a builtin type. See pushdecl. */
- if (decl && TREE_TYPE (decl) != error_mark_node
- && DECL_ORIGINAL_TYPE (decl) == NULL_TREE)
+ else if (decl && TREE_TYPE (decl) != error_mark_node
+ && DECL_ORIGINAL_TYPE (decl) == NULL_TREE)
{
tree tt = TREE_TYPE (decl);
*type = build_variant_type_copy (*type);
@@ -6704,7 +6706,7 @@ handle_aligned_attribute (tree *node, tree ARG_UNUSED (name), tree args,
TREE_USED (*type) = TREE_USED (decl);
TREE_TYPE (decl) = *type;
}
- else if (!(flags & (int) ATTR_FLAG_TYPE_IN_PLACE))
+ else
*type = build_variant_type_copy (*type);
TYPE_ALIGN (*type) = (1U << i) * BITS_PER_UNIT;
diff --git a/gcc/testsuite/g++.dg/ext/attrib39.C b/gcc/testsuite/g++.dg/ext/attrib39.C
new file mode 100644
index 0000000..22a7429
--- /dev/null
+++ b/gcc/testsuite/g++.dg/ext/attrib39.C
@@ -0,0 +1,9 @@
+// PR debug/43370
+// { dg-options "-g" }
+
+int fragile_block(void) {
+ typedef __attribute__ ((aligned (16))) struct {
+ int i;
+ } XmmUint16;
+ return 0;
+}