------- Comment #5 from jakub at gcc dot gnu dot org  2010-09-10 15:47 -------
For arbitrary lengths (both of the constant string and of the padding) the
memmove (which will be optimized to memcpy as the source is read-only) + memset
is the best thing to do, replacing say
memmove (x, "900 bytes long string", 900);
memset (x + 900, ' ', 100);
would be very .rodata size unfriendly.
So, the question is, do we want to optimize this for very small sizes of both
(what sizes?  Should we call can_store_by_pieces to determine that from the
FE?)
in the FE by transforming that say
memmove (x, "ABCDE", 5);
memset (x + 5, ' ', 3);
into
memcpy (x, "ABCDE   ", 8);
or should we do this generically in the middle-end, where we'd do this
transformation for such cases even for other languages?


-- 

jakub at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45636

Reply via email to