[Bug sanitizer/79993] [5/6/7 Regression] ICE in tree_to_uhwi, at tree.c:7344
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Mar 31 14:51:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79993
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |ASSIGNED
Assignee|unassigned at gcc dot gnu.org |jakub at gcc dot gnu.org
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So far I have:
--- gcc/cp/typeck2.c.jj 2017-03-02 08:08:42.000000000 +0100
+++ gcc/cp/typeck2.c 2017-03-31 15:36:54.366928789 +0200
@@ -739,7 +739,9 @@ split_nonconstant_init (tree dest, tree
if (TREE_CODE (init) == TARGET_EXPR)
init = TARGET_EXPR_INITIAL (init);
- if (TREE_CODE (init) == CONSTRUCTOR)
+ if (TREE_CODE (init) == CONSTRUCTOR
+ || (TREE_CODE (init) == STRING_CST
+ && array_of_runtime_bound_p (TREE_TYPE (dest))))
{
init = cp_fully_fold (init);
code = push_stmt_list ();
@@ -1066,7 +1068,7 @@ digest_init_r (tree type, tree init, boo
}
}
- if (type != TREE_TYPE (init))
+ if (type != TREE_TYPE (init) && !array_of_runtime_bound_p (type))
{
init = copy_node (init);
TREE_TYPE (init) = type;
--- gcc/cp/init.c.jj 2017-03-21 08:04:13.000000000 +0100
+++ gcc/cp/init.c 2017-03-31 16:38:18.346535659 +0200
@@ -4199,7 +4199,12 @@ build_vec_init (tree base, tree maxindex
else if (from_array)
{
if (init)
- /* OK, we set base2 above. */;
+ {
+ /* OK, we set base2 above. */
+ if (TREE_CODE (init) == STRING_CST
+ && array_of_runtime_bound_p (atype))
+ empty_list = true;
+ }
else if (CLASS_TYPE_P (type)
&& ! TYPE_HAS_DEFAULT_CONSTRUCTOR (type))
{
and the remaining part is changing build_vec_init, so that it will perform the
memcpy (MEM_REF = STRING_CST) followed by the initialization of the rest.
More information about the Gcc-bugs
mailing list