diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-01-24 16:59:44 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-01-24 16:59:44 +0000 |
commit | 54550ecb5a831f02a9e455df52509279e4f07093 (patch) | |
tree | 36f4072e307eac2f4d911a7cf4d0ab3e54d7dc0f /gcc/c | |
parent | 86a4f466b265a66a660ec3f29ce93c678054006a (diff) | |
download | gcc-54550ecb5a831f02a9e455df52509279e4f07093.tar.gz |
PR c/56078
* c-typeck.c (set_nonincremental_init_from_string): If
constructor_max_index is NULL, treat it as if tree_int_cst_lt
returned false.
(process_init_element): Likewise.
* gcc.dg/pr56078.c: New test.
* gcc.c-torture/compile/20030305-1.c: Add dg-error lines.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@195432 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c')
-rw-r--r-- | gcc/c/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 10 |
2 files changed, 14 insertions, 4 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 3acb88a1541..b78666c9bcd 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,11 @@ +2013-01-24 Jakub Jelinek <jakub@redhat.com> + + PR c/56078 + * c-typeck.c (set_nonincremental_init_from_string): If + constructor_max_index is NULL, treat it as if tree_int_cst_lt + returned false. + (process_init_element): Likewise. + 2012-12-20 Jakub Jelinek <jakub@redhat.com> PR c++/55619 diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index ccb402c26f7..ddb6d39774f 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -7574,7 +7574,9 @@ set_nonincremental_init_from_string (tree str, end = p + TREE_STRING_LENGTH (str); for (purpose = bitsize_zero_node; - p < end && !tree_int_cst_lt (constructor_max_index, purpose); + p < end + && !(constructor_max_index + && tree_int_cst_lt (constructor_max_index, purpose)); purpose = size_binop (PLUS_EXPR, purpose, bitsize_one_node)) { if (wchar_bytes == 1) @@ -8106,9 +8108,9 @@ process_init_element (struct c_expr value, bool implicit, true, braced_init_obstack); else if ((TREE_CODE (constructor_type) == ARRAY_TYPE || TREE_CODE (constructor_type) == VECTOR_TYPE) - && (constructor_max_index == 0 - || tree_int_cst_lt (constructor_max_index, - constructor_index))) + && 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 |