[PATCH] Fix PR c++/42556
Eric Botcazou
ebotcazou@adacore.com
Tue Mar 23 22:17:00 GMT 2010
> For the case
>
> int v[4] = {a, b, c, d};
>
> All the four initializers are non-constant. The C++ front end will split
> them out as
>
> v[0] = a;
> v[1] = b;
> v[2] = c;
> v[3] = d;
>
> For such empty CONSTRUCTOR, we can remove it in C++ front end. But when
> there are several constant initializers, like:
>
> int v[4] = {1, 2, c, d};
>
> When come out the C++ front end, it becomes
>
> int v[4] = {1, 2};
> v[2] = c;
> v[3] = d;
>
> We cannot remove the CONSTRUCTOR in C++ front end since it's not empty.
> But gimplifier does not know v[2] and v[3] have already been initialized
> by the front end. So after it turns v[0] and v[1] into separate
> initializations, it doesn't remove the empty CONSTRUCTOR.
OK, thanks for the detailed explanation. Could you provide a third testcase
that explicitly exercises the latter case?
--
Eric Botcazou
More information about the Gcc-patches
mailing list