[Bug middle-end/95886] suboptimal memcpy with embedded zero bytes

2020-06-24 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95886

Martin Sebor  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
 Ever confirmed|0   |1
   Assignee|unassigned at gcc dot gnu.org  |msebor at gcc dot 
gnu.org
   Last reconfirmed||2020-06-24

--- Comment #1 from Martin Sebor  ---
I'm testing a fix.

[Bug middle-end/95886] suboptimal memcpy with embedded zero bytes

2020-06-24 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95886

Martin Sebor  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=95887

--- Comment #2 from Martin Sebor  ---
See also pr95887 for a related problem with memcmp.

[Bug middle-end/95886] suboptimal memcpy with embedded zero bytes

2020-06-30 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95886

Martin Sebor  changed:

   What|Removed |Added

   Keywords||patch

--- Comment #3 from Martin Sebor  ---
Patch: https://gcc.gnu.org/pipermail/gcc-patches/2020-July/549225.html

[Bug middle-end/95886] suboptimal memcpy with embedded zero bytes

2020-07-20 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95886

--- Comment #4 from CVS Commits  ---
The master branch has been updated by Martin Sebor :

https://gcc.gnu.org/g:d5803b9876b3d11c93d1a10fabb3fbb1c4a14bd6

commit r11-2231-gd5803b9876b3d11c93d1a10fabb3fbb1c4a14bd6
Author: Martin Sebor 
Date:   Mon Jul 20 12:06:18 2020 -0600

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.

[Bug middle-end/95886] suboptimal memcpy with embedded zero bytes

2020-07-20 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95886

Martin Sebor  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #5 from Martin Sebor  ---
Fixed in r11-2231.

[Bug middle-end/95886] suboptimal memcpy with embedded zero bytes

2020-07-23 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95886

--- Comment #6 from CVS Commits  ---
The master branch has been updated by Martin Sebor :

https://gcc.gnu.org/g:8598657c607500512075f6c4ee3b10460c94903d

commit r11-2298-g8598657c607500512075f6c4ee3b10460c94903d
Author: Martin Sebor 
Date:   Thu Jul 23 14:08:22 2020 -0600

Restrict test to LP64.

gcc/testsuite/ChangeLog:

PR testsuite/95886
* gcc.target/i386/memcpy-pr95886.c: Restrict test to LP64.

[Bug middle-end/95886] suboptimal memcpy with embedded zero bytes

2020-07-23 Thread cvs-commit at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95886

--- Comment #7 from CVS Commits  ---
The master branch has been updated by H.J. Lu :

https://gcc.gnu.org/g:b0e5ec934e7a7473275326e2aee58eaf252cdff1

commit r11-2301-gb0e5ec934e7a7473275326e2aee58eaf252cdff1
Author: H.J. Lu 
Date:   Thu Jul 23 19:14:06 2020 -0700

Restrict PR middle-end/95886 x86 test to !ia32

Since gcc.target/i386/memcpy-pr95886.c requires 64-bit register, restrict
it to !ia32.

PR middle-end/95886
* gcc.target/i386/memcpy-pr95886.c: Restrict test to !ia32.

[Bug middle-end/95886] suboptimal memcpy with embedded zero bytes

2020-10-08 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95886

--- Comment #8 from CVS Commits  ---
The releases/gcc-10 branch has been updated by Martin Sebor
:

https://gcc.gnu.org/g:e4c9aac98611f63847ef6c57916808d9a2d7abcb

commit r10-8871-ge4c9aac98611f63847ef6c57916808d9a2d7abcb
Author: Martin Sebor 
Date:   Thu Oct 8 12:35:01 2020 -0600

Correct handling of constant representations containing embedded nuls
(backport from trunk).

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.

[Bug middle-end/95886] suboptimal memcpy with embedded zero bytes

2020-10-16 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95886

--- Comment #9 from CVS Commits  ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:75a016e24a335db9c93ccd2478433adfe773d898

commit r10-8903-g75a016e24a335db9c93ccd2478433adfe773d898
Author: Martin Sebor 
Date:   Thu Jul 23 14:08:22 2020 -0600

Restrict test to LP64.

gcc/testsuite/ChangeLog:

PR testsuite/95886
* gcc.target/i386/memcpy-pr95886.c: Restrict test to LP64.

(cherry picked from commit 8598657c607500512075f6c4ee3b10460c94903d)

[Bug middle-end/95886] suboptimal memcpy with embedded zero bytes

2020-10-16 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95886

--- Comment #10 from CVS Commits  ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
:

https://gcc.gnu.org/g:0cf293649b6c495249854133159ef66bf9c43904

commit r10-8904-g0cf293649b6c495249854133159ef66bf9c43904
Author: H.J. Lu 
Date:   Thu Jul 23 19:14:06 2020 -0700

Restrict PR middle-end/95886 x86 test to !ia32

Since gcc.target/i386/memcpy-pr95886.c requires 64-bit register, restrict
it to !ia32.

PR middle-end/95886
* gcc.target/i386/memcpy-pr95886.c: Restrict test to !ia32.

(cherry picked from commit b0e5ec934e7a7473275326e2aee58eaf252cdff1)