Commit f4f18103 by Mark Mitchell

re PR target/20673 (C PCH testsuite assembly comparison failure)

	PR c++/20673
	* decl.c (grokdeclarator): Correct attribute handling.

	PR c++/20673
	* g++.dg/ext/attrib21.C: New test.

From-SVN: r97640
parent 3e0de9d1
...@@ -7059,9 +7059,7 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7059,9 +7059,7 @@ grokdeclarator (const cp_declarator *declarator,
/* Determine the type of the entity declared by recurring on the /* Determine the type of the entity declared by recurring on the
declarator. */ declarator. */
for (; for (; declarator; declarator = declarator->declarator)
declarator && declarator->kind != cdk_id;
declarator = declarator->declarator)
{ {
const cp_declarator *inner_declarator; const cp_declarator *inner_declarator;
tree attrs; tree attrs;
...@@ -7069,8 +7067,6 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7069,8 +7067,6 @@ grokdeclarator (const cp_declarator *declarator,
if (type == error_mark_node) if (type == error_mark_node)
return error_mark_node; return error_mark_node;
inner_declarator = declarator->declarator;
attrs = declarator->attributes; attrs = declarator->attributes;
if (attrs) if (attrs)
{ {
...@@ -7088,6 +7084,11 @@ grokdeclarator (const cp_declarator *declarator, ...@@ -7088,6 +7084,11 @@ grokdeclarator (const cp_declarator *declarator,
attr_flags); attr_flags);
} }
if (declarator->kind == cdk_id)
break;
inner_declarator = declarator->declarator;
switch (declarator->kind) switch (declarator->kind)
{ {
case cdk_array: case cdk_array:
......
// PR c++/20673
typedef void *voidp;
struct S
{
char a;
voidp __attribute__ ((aligned (16))) b;
};
struct T
{
char a;
void *__attribute__ ((aligned (16))) b;
};
int f[sizeof (struct S) != sizeof (struct T) ? -1 : 1];
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment