aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYvan Roux <yvan.roux@linaro.org>2015-11-19 08:55:36 +0100
committerLinaro Code Review <review@review.linaro.org>2015-11-20 12:32:40 +0000
commit1616d8ed0f1bc73853c958ffedee4cbe64d761f2 (patch)
tree34cb829fbfae9043d29d89e158fa0af556d4e641
parent46d65a9e66c261a7e560d9a8cd4be0f47af28eda (diff)
gcc/c/
Backport from trunk r229505. 2015-10-26 Jim Wilson <jim.wilson@linaro.org> PR debug/66068 * c-typeck.c (c_build_qualified_type): Clear C_TYPE_INCOMPLETE_VARS after calling build_qualified_type. gcc/testsuite/ Backport from trunk r229505. 2015-10-26 Jim Wilson <jim.wilson@linaro.org> PR debug/66068 * gcc.dg/debug/pr66068.c: New test. Change-Id: Id73aa8022bd86032101a0682073c109b5162f3cc
-rw-r--r--gcc/c/c-typeck.c8
-rw-r--r--gcc/testsuite/gcc.dg/debug/pr66068.c13
2 files changed, 20 insertions, 1 deletions
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index ffba66bb6c4..c8df1bb7163 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -12639,7 +12639,13 @@ c_build_qualified_type (tree type, int type_quals)
type_quals &= ~TYPE_QUAL_RESTRICT;
}
- return build_qualified_type (type, type_quals);
+ tree var_type = build_qualified_type (type, type_quals);
+ /* A variant type does not inherit the list of incomplete vars from the
+ type main variant. */
+ if (TREE_CODE (var_type) == RECORD_TYPE
+ || TREE_CODE (var_type) == UNION_TYPE)
+ C_TYPE_INCOMPLETE_VARS (var_type) = 0;
+ return var_type;
}
/* Build a VA_ARG_EXPR for the C parser. */
diff --git a/gcc/testsuite/gcc.dg/debug/pr66068.c b/gcc/testsuite/gcc.dg/debug/pr66068.c
new file mode 100644
index 00000000000..d9cd9050e8d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/debug/pr66068.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+
+struct S a;
+const struct S b;
+struct S
+{
+};
+
+union U c;
+const union U d;
+union U
+{
+};