diff options
author | Martin Sebor <msebor@redhat.com> | 2020-07-20 12:06:18 -0600 |
---|---|---|
committer | Martin Sebor <msebor@redhat.com> | 2020-07-20 12:08:58 -0600 |
commit | d5803b9876b3d11c93d1a10fabb3fbb1c4a14bd6 (patch) | |
tree | 21c9c55bfd9003436d22c960d3578579af9dd744 /gcc/tree-vect-stmts.c | |
parent | 3e99ed65cbedf7a6c0abb9cd63c191326995fd34 (diff) | |
download | gcc-d5803b9876b3d11c93d1a10fabb3fbb1c4a14bd6.zip gcc-d5803b9876b3d11c93d1a10fabb3fbb1c4a14bd6.tar.gz gcc-d5803b9876b3d11c93d1a10fabb3fbb1c4a14bd6.tar.bz2 |
Correct handling of constant representations containing embedded nuls.
Resolves:
PR middle-end/95189 - memcmp being wrongly stripped like strcm
PR middle-end/95886 - suboptimal memcpy with embedded zero bytes
gcc/ChangeLog:
PR middle-end/95189
PR middle-end/95886
* builtins.c (inline_expand_builtin_string_cmp): Rename...
(inline_expand_builtin_bytecmp): ...to this.
(builtin_memcpy_read_str): Don't expect data to be nul-terminated.
(expand_builtin_memory_copy_args): Handle object representations
with embedded nul bytes.
(expand_builtin_memcmp): Same.
(expand_builtin_strcmp): Adjust call to naming change.
(expand_builtin_strncmp): Same.
* expr.c (string_constant): Create empty strings with nonzero size.
* fold-const.c (c_getstr): Rename locals and update comments.
* tree.c (build_string): Accept null pointer argument.
(build_string_literal): Same.
* tree.h (build_string): Provide a default.
(build_string_literal): Same.
gcc/testsuite/ChangeLog:
PR middle-end/95189
PR middle-end/95886
* gcc.dg/memcmp-pr95189.c: New test.
* gcc.dg/strncmp-3.c: New test.
* gcc.target/i386/memcpy-pr95886.c: New test.
Diffstat (limited to 'gcc/tree-vect-stmts.c')
0 files changed, 0 insertions, 0 deletions