poly_int64 offset, offset2;
tree val = integer_zero_node;
if (gimple_store_p (defstmt)
+ && gimple_assign_single_p (defstmt)
+ && TREE_CODE (gimple_assign_rhs1 (defstmt)) == STRING_CST
+ && !gimple_clobber_p (defstmt))
+ {
+ tree str = gimple_assign_rhs1 (defstmt);
+ src2 = gimple_assign_lhs (defstmt);
+ /* The string must contain all null char's for now. */
+ for (int i = 0; i < TREE_STRING_LENGTH (str); i++)
+ {
+ if (TREE_STRING_POINTER (str)[i] != 0)
+ {
+ src2 = NULL_TREE;
+ break;
+ }
+ }
+ }
+ else if (gimple_store_p (defstmt)
&& gimple_assign_single_p (defstmt)
&& TREE_CODE (gimple_assign_rhs1 (defstmt)) == CONSTRUCTOR
&& !gimple_clobber_p (defstmt))
--- /dev/null
+/* PR tree-optimization/78408 */
+/* { dg-do compile { target size32plus } } */
+/* { dg-options "-O2 -fdump-tree-forwprop1-details" } */
+/* { dg-final { scan-tree-dump-times "after previous" 1 "forwprop1" } } */
+
+void* aaa();
+void* bbb()
+{
+ void* ret = aaa();
+ char buf[32] = {};
+ __builtin_memcpy(ret, buf, 32);
+ return ret;
+}
+