Jakub Jelinek <jakub at gcc dot> changed:

           What    |Removed                     |Added
                 CC|                            |jakub at gcc dot,
                   |                            |jason at gcc dot

--- Comment #2 from Jakub Jelinek <jakub at gcc dot> ---
But this isn't a designed array initializer, it is a normal initializer with
side-effects in it.
And presumably the C++ FE lowered that into
{[3]=5, [0]=5, [7]=3, [1]=3}
which is considered invalid by the middle-end, since it isn't sorted by
increasing index.
static int array[10] = { array[3]=5, array[7]=3, array[7]=8, array[7] = 9 };
it is even worse, we get
{[3]=5, [0]=5, [7]=9, [1]=3, [2]=8, [3]=9}
so [3] is written twice.  Not sure if this isn't undefined behavior (I hope it
is), but still we shouldn't ICE on it, best would be not to turn the stores
into CONSTRUCTOR elements, but just handle the side-effects at runtime.

Reply via email to