From: Jakub Jelinek Date: Fri, 14 Jan 2005 23:51:38 +0000 (+0100) Subject: re PR c++/19263 (wrong-code: explicit initialization of v8qi miscompiled) X-Git-Tag: releases/gcc-3.4.4~312 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=56521b1856a55d3755257c9396a75c97c84c0ae1;p=thirdparty%2Fgcc.git re PR c++/19263 (wrong-code: explicit initialization of v8qi miscompiled) PR c++/19263 * typeck2.c (split_nonconstant_init_1) : Put a copy of CONSTRUCTOR's node into MODIFY_EXPR, as the original is modified. Store code to *pcode. * g++.dg/init/vector1.C: New test. From-SVN: r93674 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 0d0051ea2db2..e31e6db6f9b7 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2005-01-15 Jakub Jelinek + + PR c++/19263 + * typeck2.c (split_nonconstant_init_1) : Put a copy + of CONSTRUCTOR's node into MODIFY_EXPR, as the original is modified. + Store code to *pcode. + 2004-12-28 Jakub Jelinek PR c++/18384, c++/18327 diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index f11dbe19850d..780c3e7abe4d 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -348,9 +348,11 @@ split_nonconstant_init_1 (tree dest, tree init, tree *pcode) case VECTOR_TYPE: if (!initializer_constant_valid_p (init, type)) { + tree cons = copy_node (init); CONSTRUCTOR_ELTS (init) = NULL; - code = build (MODIFY_EXPR, type, dest, init); + code = build (MODIFY_EXPR, type, dest, cons); code = build_stmt (EXPR_STMT, code); + *pcode = code; pcode = &TREE_CHAIN (code); } break; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 382711907d34..82cf8659c0f8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-01-15 Jakub Jelinek + + PR c++/19263 + * g++.dg/init/vector1.C: New test. + 2005-01-07 Jakub Jelinek * gcc.c-torture/execute/20050107-1.c: New test.