aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/tree.c4
-rw-r--r--gcc/testsuite/g++.target/i386/pr102548.C12
2 files changed, 14 insertions, 2 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index d67d785..32ddf83 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -1499,9 +1499,9 @@ apply_identity_attributes (tree result, tree attribs, bool *remove_attributes)
p = &TREE_CHAIN (*p);
}
}
- else if (first_ident)
+ else if (first_ident && first_ident != error_mark_node)
{
- for (tree a2 = first_ident; a2; a2 = TREE_CHAIN (a2))
+ for (tree a2 = first_ident; a2 != a; a2 = TREE_CHAIN (a2))
{
*p = tree_cons (TREE_PURPOSE (a2), TREE_VALUE (a2), NULL_TREE);
p = &TREE_CHAIN (*p);
diff --git a/gcc/testsuite/g++.target/i386/pr102548.C b/gcc/testsuite/g++.target/i386/pr102548.C
new file mode 100644
index 0000000..e1238c3
--- /dev/null
+++ b/gcc/testsuite/g++.target/i386/pr102548.C
@@ -0,0 +1,12 @@
+// PR c++/102548
+// { dg-do compile { target { c++14 && ia32 } } }
+
+typedef decltype(sizeof(0)) size_t;
+struct tm;
+extern "C" size_t __attribute__((__cdecl__)) strftime (char *, size_t, const char *, const struct tm *);
+
+auto
+foo (void)
+{
+ return strftime;
+}