Commit ce662d4c by Jakub Jelinek Committed by Jakub Jelinek

c-typeck.c (set_init_index): If first is equal to last, assume as if it was not a range at all.

	* c-typeck.c (set_init_index): If first is equal to last, assume as
	if it was not a range at all.

	* gcc.dg/gnu99-init-1.c: Add test for [0 ... 0] range.

From-SVN: r39380
parent 4673dd2c
2001-01-31 Jakub Jelinek <jakub@redhat.com>
* c-typeck.c (set_init_index): If first is equal to last, assume as
if it was not a range at all.
2001-01-31 Alexandre Oliva <aoliva@redhat.com>
* config/fp-bit.c: Include tm.h.
......
......@@ -5688,12 +5688,16 @@ set_init_index (first, last)
{
constructor_index = convert (bitsizetype, first);
if (last != 0 && tree_int_cst_lt (last, first))
if (last)
{
if (tree_int_cst_equal (first, last))
last = 0;
else if (tree_int_cst_lt (last, first))
{
error_init ("empty index range in initializer");
last = 0;
}
else if (last)
else
{
last = convert (bitsizetype, last);
if (constructor_max_index != 0
......@@ -5703,6 +5707,8 @@ set_init_index (first, last)
last = 0;
}
}
}
designator_depth++;
designator_errorneous = 0;
if (constructor_range_stack || last)
......
2001-01-31 Jakub Jelinek <jakub@redhat.com>
* gcc.dg/gnu99-init-1.c: Add test for [0 ... 0] range.
2001-01-31 Jeffrey Oldham <oldham@codesourcery.com>
* gcc.dg/c99-float-1.c: Back out "XFAIL FLT_EVAL_METHOD and
......
......@@ -24,6 +24,7 @@ struct M o[] = { [0 ... 5].O = { [1 ... 2].K[0 ... 1] = 4 },
struct M p[] = { [0 ... 5].O[1 ... 2].K = { [0 ... 1] = 4 },
[5].O[2].K[2] = 5, 6, 7 };
int q[3][3] = { [0 ... 1] = { [1 ... 2] = 23 }, [1][2] = 24 };
int r[1] = { [0 ... 1 - 1] = 27 };
int main (void)
{
......@@ -73,5 +74,7 @@ int main (void)
abort ();
if (q[2][0] || q[2][1] || q[2][2])
abort ();
if (r[0] != 27)
abort ();
exit (0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment