aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-strlen.cc
diff options
context:
space:
mode:
authorJerry DeLisle <jvdelisle@gcc.gnu.org>2025-09-02 15:58:26 -0700
committerJerry DeLisle <jvdelisle@gcc.gnu.org>2025-09-02 15:58:26 -0700
commit071b4126c613881f4cb25b4e5c39032964827f88 (patch)
tree7ed805786566918630d1d617b1ed8f7310f5fd8e /gcc/tree-ssa-strlen.cc
parent845d23f3ea08ba873197c275a8857eee7edad996 (diff)
parentcaa1c2f42691d68af4d894a5c3e700ecd2dba080 (diff)
downloadgcc-devel/gfortran-test.zip
gcc-devel/gfortran-test.tar.gz
gcc-devel/gfortran-test.tar.bz2
Merge branch 'master' into gfortran-testdevel/gfortran-test
Diffstat (limited to 'gcc/tree-ssa-strlen.cc')
-rw-r--r--gcc/tree-ssa-strlen.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/tree-ssa-strlen.cc b/gcc/tree-ssa-strlen.cc
index c4d6413..3cef33b 100644
--- a/gcc/tree-ssa-strlen.cc
+++ b/gcc/tree-ssa-strlen.cc
@@ -4009,8 +4009,16 @@ strlen_pass::handle_builtin_memcmp ()
tree ptrtype = build_pointer_type_for_mode (char_type_node,
ptr_mode, true);
off = build_int_cst (ptrtype, 0);
- arg1 = build2_loc (loc, MEM_REF, type, arg1, off);
- arg2 = build2_loc (loc, MEM_REF, type, arg2, off);
+
+ /* Create unaligned types if needed. */
+ tree type1 = type, type2 = type;
+ if (TYPE_ALIGN (type1) > align1)
+ type1 = build_aligned_type (type1, align1);
+ if (TYPE_ALIGN (type2) > align2)
+ type2 = build_aligned_type (type2, align2);
+
+ arg1 = build2_loc (loc, MEM_REF, type1, arg1, off);
+ arg2 = build2_loc (loc, MEM_REF, type2, arg2, off);
tree tem1 = fold_const_aggregate_ref (arg1);
if (tem1)
arg1 = tem1;