GCC Status Report (2004-03-09)

Richard Henderson rth@redhat.com
Thu Mar 11 21:11:00 GMT 2004


On Thu, Mar 11, 2004 at 11:39:11AM +0100, Jakub Jelinek wrote:
> BTW, there is one optimization which we perhaps could do.  People often
> write:
> void foo (void)
> {
>   const char bar[16] = { 0x80 };
>   baz (bar);
> }
> which could be optimized into:
> void foo (void)
> {
>   static const char bar[16] = { 0x80 };
>   baz (bar);
> }
> 
> Then we can get rid of the runtime initialization altogether.
> This could be done either if the whole aggregate is const, or if all fields
> are const.

This does indeed happen on tree-ssa branch if the whole aggregate
is const.


r~



More information about the Gcc mailing list