[PATCH] SHF_MERGE support for gcc

Joseph S. Myers jsm28@cam.ac.uk
Fri Apr 20 12:08:00 GMT 2001


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.)

-- 
Joseph S. Myers
jsm28@cam.ac.uk



More information about the Gcc-patches mailing list