This is the mail archive of the gcc-patches@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]

Re: [PATCH] SHF_MERGE support for gcc


On Fri, Apr 20, 2001 at 08:08:20PM +0100, Joseph S. Myers wrote:
> Jakub Jelinek wrote:
> > The patch below is perhaps too aggressive, it merges e.g. even:
> > const double d = 2.0;
> > const double e = 2.0;
> > into one memory location, is there something wrong about it from
> > the standards point of view? If yes, the patch can limit itself to
> > non-variables (ie. just STRING_CSTs which are not constant arrays
> > and constant pool).
> 
> In C, variables are distinct objects (with their own addresses), and
> distinct from non-variables, but string constants and const-qualified
> compound literals may share storage with each other and with other string
> constants and const-qualified compound literals.  (See the thread on
> "Merging objects" in comp.std.c last November.)

It does bend the rules, but I'd like to see the complete merging
behavior available as an option in C, and present in the back-end for
languages with less stringent rules (Fortran?).  I could even argue
that it ought to be on by default in C and off only in s.c. mode; the
programs that care about the difference are unusual and the space
savings can be significant.

Does SHF_MERGE|SHF_STRINGS pack together "foobar" and "bar" ?

zw
also wants an option to put explicitly initialized zeros in .bss


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