diff options
author | Alexandre Oliva <oliva@adacore.com> | 2023-12-11 15:09:22 -0300 |
---|---|---|
committer | Alexandre Oliva <oliva@gnu.org> | 2023-12-11 15:26:41 -0300 |
commit | 76ca5ab4ef95c41c1ed67edfb34a1a455a602192 (patch) | |
tree | e5d493ba494f4fb0e819ca2915c3ed61bbcd2229 /gcc | |
parent | 07d9f2fce81a3052b5421f10149e7bd5270b5946 (diff) | |
download | gcc-76ca5ab4ef95c41c1ed67edfb34a1a455a602192.zip gcc-76ca5ab4ef95c41c1ed67edfb34a1a455a602192.tar.gz gcc-76ca5ab4ef95c41c1ed67edfb34a1a455a602192.tar.bz2 |
-finline-stringops: don't assume ptr_mode ptr in memset [PR112804]
On aarch64 -milp32, and presumably on other such targets, ptr can be
in a different mode than ptr_mode in the testcase. Cope with it.
for gcc/ChangeLog
PR target/112804
* builtins.cc (try_store_by_multiple_pieces): Use ptr's mode
for the increment.
for gcc/testsuite/ChangeLog
PR target/112804
* gcc.target/aarch64/inline-mem-set-pr112804.c: New.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/builtins.cc | 2 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/aarch64/inline-mem-set-pr112804.c | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/builtins.cc b/gcc/builtins.cc index 38b0acf..12a535d 100644 --- a/gcc/builtins.cc +++ b/gcc/builtins.cc @@ -4519,7 +4519,7 @@ try_store_by_multiple_pieces (rtx to, rtx len, unsigned int ctz_len, to = change_address (to, QImode, 0); emit_move_insn (to, val); if (update_needed) - next_ptr = plus_constant (ptr_mode, ptr, blksize); + next_ptr = plus_constant (GET_MODE (ptr), ptr, blksize); } else { diff --git a/gcc/testsuite/gcc.target/aarch64/inline-mem-set-pr112804.c b/gcc/testsuite/gcc.target/aarch64/inline-mem-set-pr112804.c new file mode 100644 index 0000000..fe84145 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/inline-mem-set-pr112804.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-finline-stringops -mabi=ilp32 -ftrivial-auto-var-init=zero" } */ + +short m(unsigned k) { + const unsigned short *n[65]; + return 0; +} |