This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC Status Report (2004-03-09)


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~


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]