/usr/src/gcc-4.9/debian/patches/linaro-revert-r233493.diff is in gcc-4.9-source 4.9.3-13ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | Index: gcc/c/c-parser.c
===================================================================
--- a/src/gcc/c/c-parser.c (revision 233493)
+++ a/src/gcc/c/c-parser.c (revision 233491)
@@ -1161,8 +1161,7 @@
static tree c_parser_attributes (c_parser *);
static struct c_type_name *c_parser_type_name (c_parser *);
static struct c_expr c_parser_initializer (c_parser *);
-static struct c_expr c_parser_braced_init (c_parser *, tree, bool,
- struct obstack *);
+static struct c_expr c_parser_braced_init (c_parser *, tree, bool);
static void c_parser_initelt (c_parser *, struct obstack *);
static void c_parser_initval (c_parser *, struct c_expr *,
struct obstack *);
@@ -4089,7 +4088,7 @@
c_parser_initializer (c_parser *parser)
{
if (c_parser_next_token_is (parser, CPP_OPEN_BRACE))
- return c_parser_braced_init (parser, NULL_TREE, false, NULL);
+ return c_parser_braced_init (parser, NULL_TREE, false);
else
{
struct c_expr ret;
@@ -4109,8 +4108,7 @@
top-level initializer in a declaration. */
static struct c_expr
-c_parser_braced_init (c_parser *parser, tree type, bool nested_p,
- struct obstack *outer_obstack)
+c_parser_braced_init (c_parser *parser, tree type, bool nested_p)
{
struct c_expr ret;
struct obstack braced_init_obstack;
@@ -4119,10 +4117,7 @@
gcc_assert (c_parser_next_token_is (parser, CPP_OPEN_BRACE));
c_parser_consume_token (parser);
if (nested_p)
- {
- finish_implicit_inits (outer_obstack);
- push_init_level (0, &braced_init_obstack);
- }
+ push_init_level (0, &braced_init_obstack);
else
really_start_incremental_init (type);
if (c_parser_next_token_is (parser, CPP_CLOSE_BRACE))
@@ -4369,8 +4364,7 @@
struct c_expr init;
gcc_assert (!after || c_dialect_objc ());
if (c_parser_next_token_is (parser, CPP_OPEN_BRACE) && !after)
- init = c_parser_braced_init (parser, NULL_TREE, true,
- braced_init_obstack);
+ init = c_parser_braced_init (parser, NULL_TREE, true);
else
{
location_t loc = c_parser_peek_token (parser)->location;
@@ -7570,7 +7564,7 @@
error_at (type_loc, "compound literal has variable size");
type = error_mark_node;
}
- init = c_parser_braced_init (parser, type, false, NULL);
+ init = c_parser_braced_init (parser, type, false);
finish_init ();
maybe_warn_string_init (type, init);
Index: gcc/c/c-typeck.c
===================================================================
--- a/src/gcc/c/c-typeck.c (revision 233493)
+++ a/src/gcc/c/c-typeck.c (revision 233491)
@@ -7164,29 +7164,6 @@
}
}
-/* Called when we see an open brace for a nested initializer. Finish
- off any pending levels with implicit braces. */
-void
-finish_implicit_inits (struct obstack *braced_init_obstack)
-{
- while (constructor_stack->implicit)
- {
- if ((TREE_CODE (constructor_type) == RECORD_TYPE
- || TREE_CODE (constructor_type) == UNION_TYPE)
- && constructor_fields == 0)
- process_init_element (pop_init_level (1, braced_init_obstack),
- true, braced_init_obstack);
- else if (TREE_CODE (constructor_type) == ARRAY_TYPE
- && constructor_max_index
- && tree_int_cst_lt (constructor_max_index,
- constructor_index))
- process_init_element (pop_init_level (1, braced_init_obstack),
- true, braced_init_obstack);
- else
- break;
- }
-}
-
/* Push down into a subobject, for initialization.
If this is for an explicit set of braces, IMPLICIT is 0.
If it is because the next element belongs at a lower level,
@@ -7198,6 +7175,32 @@
struct constructor_stack *p;
tree value = NULL_TREE;
+ /* If we've exhausted any levels that didn't have braces,
+ pop them now. If implicit == 1, this will have been done in
+ process_init_element; do not repeat it here because in the case
+ of excess initializers for an empty aggregate this leads to an
+ infinite cycle of popping a level and immediately recreating
+ it. */
+ if (implicit != 1)
+ {
+ while (constructor_stack->implicit)
+ {
+ if ((TREE_CODE (constructor_type) == RECORD_TYPE
+ || TREE_CODE (constructor_type) == UNION_TYPE)
+ && constructor_fields == 0)
+ process_init_element (pop_init_level (1, braced_init_obstack),
+ true, braced_init_obstack);
+ else if (TREE_CODE (constructor_type) == ARRAY_TYPE
+ && constructor_max_index
+ && tree_int_cst_lt (constructor_max_index,
+ constructor_index))
+ process_init_element (pop_init_level (1, braced_init_obstack),
+ true, braced_init_obstack);
+ else
+ break;
+ }
+ }
+
/* Unless this is an explicit brace, we need to preserve previous
content if any. */
if (implicit)
@@ -7608,7 +7611,6 @@
}
constructor_designated = 1;
- finish_implicit_inits (braced_init_obstack);
push_init_level (2, braced_init_obstack);
return 0;
}
@@ -8939,7 +8941,6 @@
p = p->next;
if (!p)
break;
- finish_implicit_inits (braced_init_obstack);
push_init_level (2, braced_init_obstack);
p->stack = constructor_stack;
if (p->range_end && tree_int_cst_equal (p->index, p->range_end))
Index: gcc/c/c-tree.h
===================================================================
--- a/src/gcc/c/c-tree.h (revision 233493)
+++ a/src/gcc/c/c-tree.h (revision 233491)
@@ -608,7 +608,6 @@
extern void start_init (tree, tree, int);
extern void finish_init (void);
extern void really_start_incremental_init (tree);
-extern void finish_implicit_inits (struct obstack *);
extern void push_init_level (int, struct obstack *);
extern struct c_expr pop_init_level (int, struct obstack *);
extern void set_init_index (tree, tree, struct obstack *);
Index: gcc/testsuite/gcc.dg/pr69522.c
===================================================================
--- a/src/gcc/testsuite/gcc.dg/pr69522.c (revision 233493)
+++ a/src/gcc/testsuite/gcc.dg/pr69522.c (nonexistent)
@@ -1,10 +0,0 @@
-/* { dg-do compile } */
-/* { dg-options "" } */
-struct str {};
-struct {
- struct str b;
- float c[1];
- int d[1];
- float e[2];
- int f[1];
-} a = {{}, 0, {0.5}, 0, 0, {0}};
|