https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120702

--- Comment #10 from Visda <Visda.vokhshoori at microchip dot com> ---
adding this amount of code in fold_ctor_reference () circumvents forward
propagating large, (>128 characters), string literals.

--- a/gcc/gimple-fold.cc
+++ b/gcc/gimple-fold.cc
@@ -8122,7 +8122,9 @@ fold_ctor_reference (tree type, tree ctor, const
poly_uint64 &poly_offset,
   /* We found the field with exact match.  */
   if (type
       && useless_type_conversion_p (type, TREE_TYPE (ctor))
-      && known_eq (poly_offset, 0U))
+      && known_eq (poly_offset, 0U)
+      && (TREE_CODE (ctor) != STRING_CST
+         || TREE_STRING_LENGTH (ctor) <= MAX_BITSIZE_MODE_ANY_MODE /
BITS_PER_UNIT))
     return canonicalize_constructor_val (unshare_expr (ctor), from_decl);


looking for feedback. thanks.

Reply via email to