https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77488

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |msebor at gcc dot gnu.org

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
Perhaps it might be possible to generalize the enhancement request to a space
optimization for GCC to store only the trailing part of strings that are ever
referenced in the program.  For instance, since in the file below only the
range [s + 5, s + 10] is ever used it should be possible to store just "56789"
instead of all of "0123456789" (this would only be possible if all computations
involving the literal were known and would have to be avoided if a pointer to
the literal escaped to an external function that could derive from it a pointer
to the initial substring).

static const char* const s = "0123456789" + 5;

void f (void)
{
  __builtin_printf ("%s\n", s);
}

Reply via email to