Ping: https://gcc.gnu.org/pipermail/gcc-patches/2020-July/551152.html
On 7/31/20 5:55 PM, Martin Sebor wrote:
The folders for these functions (and some others) call c_getsr which relies on string_constant to return the representation of constant strings. Because the function doesn't handle constants of other types, including aggregates, memcmp or memchr calls involving those are not folded when they could be. The attached patch extends the algorithm used by string_constant to also handle constant aggregates involving elements or members of the same types as native_encode_expr. (The change restores the empty initializer optimization inadvertently disabled in the fix for pr96058.) To avoid accidentally misusing either string_constant or c_getstr with non-strings I have introduced a pair of new functions to get the representation of those: byte_representation and getbyterep. Tested on x86_64-linux. Martin