aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/expr.c5
-rw-r--r--gcc/testsuite/gcc.dg/pr95052.c12
2 files changed, 17 insertions, 0 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 049d3ed..6b75028 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -5779,6 +5779,11 @@ store_expr (tree exp, rtx target, int call_param_p,
(call_param_p
? EXPAND_STACK_PARM : EXPAND_NORMAL),
&alt_rtl, false);
+ if (shortened_string_cst)
+ {
+ gcc_assert (MEM_P (temp));
+ temp = change_address (temp, BLKmode, NULL_RTX);
+ }
}
/* If TEMP is a VOIDmode constant and the mode of the type of EXP is not
diff --git a/gcc/testsuite/gcc.dg/pr95052.c b/gcc/testsuite/gcc.dg/pr95052.c
new file mode 100644
index 0000000..2ed1a03
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr95052.c
@@ -0,0 +1,12 @@
+/* PR middle-end/95052 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fconserve-stack" } */
+
+void bar (char *);
+
+void
+foo (void)
+{
+ char buf[70] = "";
+ bar (buf);
+}