From: Jakub Jelinek Date: Tue, 30 May 2017 08:15:05 +0000 (+0200) Subject: backport: re PR c++/79896 (ICE in gimplify_expr, at gimplify.c:11950 on non-int128... X-Git-Tag: releases/gcc-5.5.0~254 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d54a48d9dadb2f9ce4d5c0ad514141c29c8aa8a;p=thirdparty%2Fgcc.git backport: re PR c++/79896 (ICE in gimplify_expr, at gimplify.c:11950 on non-int128 target) Backported from mainline 2017-03-10 Jakub Jelinek PR c++/79896 * decl.c (finish_enum_value_list): If value is error_mark_node, don't copy it and change its type. * init.c (constant_value_1): Return error_mark_node if DECL_INITIAL of CONST_DECL is error_mark_node. * g++.dg/ext/int128-5.C: New test. From-SVN: r248659 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9775a4a0aed9..4f07104c040d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,14 @@ 2017-05-30 Jakub Jelinek Backported from mainline + 2017-03-10 Jakub Jelinek + + PR c++/79896 + * decl.c (finish_enum_value_list): If value is error_mark_node, + don't copy it and change its type. + * init.c (constant_value_1): Return error_mark_node if DECL_INITIAL + of CONST_DECL is error_mark_node. + 2017-02-22 Jakub Jelinek PR c++/79664 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index ce0443ca4c05..04f1c711b0cd 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -13077,9 +13077,12 @@ finish_enum_value_list (tree enumtype) input_location = saved_location; /* Do not clobber shared ints. */ - value = copy_node (value); + if (value != error_mark_node) + { + value = copy_node (value); - TREE_TYPE (value) = enumtype; + TREE_TYPE (value) = enumtype; + } DECL_INITIAL (decl) = value; } diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 3d79ba8e9343..fc1d9eff240a 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -2050,7 +2050,8 @@ constant_value_1 (tree decl, bool strict_p, bool return_aggregate_cst_ok_p) init = DECL_INITIAL (decl); if (init == error_mark_node) { - if (DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl)) + if (TREE_CODE (decl) == CONST_DECL + || DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P (decl)) /* Treat the error as a constant to avoid cascading errors on excessively recursive template instantiation (c++/9335). */ return init; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e1f99020bb0e..39e832846485 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,11 @@ 2017-05-30 Jakub Jelinek Backported from mainline + 2017-03-10 Jakub Jelinek + + PR c++/79896 + * g++.dg/ext/int128-5.C: New test. + 2017-03-09 Jakub Jelinek PR sanitizer/79944