aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/expr.c3
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/pr90025.c28
4 files changed, 37 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 84d1205..3f75399 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2019-04-10 Jakub Jelinek <jakub@redhat.com>
+ PR middle-end/90025
+ * expr.c (store_expr): Set properly size on the MEM passed to
+ clear_storage.
+
PR c++/90010
* gimple-ssa-sprintf.c (target_to_host): Fix handling of targstr
with strlen in between hostsz-3 and hostsz-1 inclusive when no
diff --git a/gcc/expr.c b/gcc/expr.c
index 9ff5e5f..fa15b7e 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -5658,7 +5658,8 @@ store_expr (tree exp, rtx target, int call_param_p,
dest_mem = store_by_pieces (target, str_copy_len, string_cst_read_str,
(void *) str, MEM_ALIGN (target), false,
RETURN_END);
- clear_storage (adjust_address (dest_mem, BLKmode, 0),
+ clear_storage (adjust_address_1 (dest_mem, BLKmode, 0, 1, 1, 0,
+ exp_len - str_copy_len),
GEN_INT (exp_len - str_copy_len), BLOCK_OP_NORMAL);
return NULL_RTX;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2f6bda8..4f69d6f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2019-04-10 Jakub Jelinek <jakub@redhat.com>
+ PR middle-end/90025
+ * gcc.c-torture/execute/pr90025.c: New test.
+
PR c++/90010
* gcc.dg/pr90010.c: New test.
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr90025.c b/gcc/testsuite/gcc.c-torture/execute/pr90025.c
new file mode 100644
index 0000000..a1ddd00
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/pr90025.c
@@ -0,0 +1,28 @@
+/* PR middle-end/90025 */
+
+__attribute__((noipa)) void
+bar (char *p)
+{
+ int i;
+ for (i = 0; i < 6; i++)
+ if (p[i] != "foobar"[i])
+ __builtin_abort ();
+ for (; i < 32; i++)
+ if (p[i] != '\0')
+ __builtin_abort ();
+}
+
+__attribute__((noipa)) void
+foo (unsigned int x)
+{
+ char s[32] = { 'f', 'o', 'o', 'b', 'a', 'r', 0 };
+ ((unsigned int *) s)[2] = __builtin_bswap32 (x);
+ bar (s);
+}
+
+int
+main ()
+{
+ foo (0);
+ return 0;
+}