diff options
author | Richard Stallman <rms@gnu.org> | 1992-11-10 14:20:47 +0000 |
---|---|---|
committer | Richard Stallman <rms@gnu.org> | 1992-11-10 14:20:47 +0000 |
commit | d14774f07b73301fc68aae6bfc7e04f5de1c498d (patch) | |
tree | ef7f6420fe6451f90943fbfadac7f7206be2858b | |
parent | 385a69e916120dea059684f91409e2b277f8eaa5 (diff) | |
download | gcc-d14774f07b73301fc68aae6bfc7e04f5de1c498d.zip gcc-d14774f07b73301fc68aae6bfc7e04f5de1c498d.tar.gz gcc-d14774f07b73301fc68aae6bfc7e04f5de1c498d.tar.bz2 |
(process_init_constructor): Strip NOP_EXPR from indices.
Clear end_index if there's an error in a range.
From-SVN: r2730
-rw-r--r-- | gcc/c-typeck.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index f06423e..1739805 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -4970,7 +4970,8 @@ process_init_constructor (type, init, elts, constant_value, constant_element, int win = 0; tree index = TREE_PURPOSE (tail); - if (index && TREE_CODE (index) == NON_LVALUE_EXPR) + if (index && (TREE_CODE (index) == NON_LVALUE_EXPR + || TREE_CODE (index) == NOP_EXPR)) index = TREE_OPERAND (index, 0); /* Begin a range. */ @@ -4979,10 +4980,15 @@ process_init_constructor (type, init, elts, constant_value, constant_element, start_index = TREE_PURPOSE (index); end_index = TREE_PURPOSE (TREE_CHAIN (index)); - /* Expose constants. */ - if (end_index && TREE_CODE (end_index) == NON_LVALUE_EXPR) + /* Expose constants. It Doesn't matter if we change + the mode.*/ + if (end_index + && (TREE_CODE (end_index) == NON_LVALUE_EXPR + || TREE_CODE (end_index) == NOP_EXPR)) end_index = TREE_OPERAND (end_index, 0); - if (start_index && TREE_CODE (start_index) == NON_LVALUE_EXPR) + if (start_index + && (TREE_CODE (start_index) == NON_LVALUE_EXPR + || TREE_CODE (start_index) == NOP_EXPR)) start_index = TREE_OPERAND (start_index, 0); if ((TREE_CODE (start_index) == IDENTIFIER_NODE) @@ -5026,7 +5032,11 @@ process_init_constructor (type, init, elts, constant_value, constant_element, current_index = index, win = 1; if (!win) - TREE_VALUE (tail) = error_mark_node; + { + /* If there was an error, end the current range. */ + end_index = 0; + TREE_VALUE (tail) = error_mark_node; + } } if (max_index && tree_int_cst_lt (max_index, current_index)) |