]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c++/79896 (ICE in gimplify_expr, at gimplify.c:11950 on non-int128...
authorJakub Jelinek <jakub@redhat.com>
Tue, 30 May 2017 08:15:05 +0000 (10:15 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 30 May 2017 08:15:05 +0000 (10:15 +0200)
Backported from mainline
2017-03-10  Jakub Jelinek  <jakub@redhat.com>

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

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/init.c
gcc/testsuite/ChangeLog

index 9775a4a0aed90c168e7de220bec7cf47880d652c..4f07104c040df6bfddec4b7827503c2d6483d8d6 100644 (file)
@@ -1,6 +1,14 @@
 2017-05-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2017-03-10  Jakub Jelinek  <jakub@redhat.com>
+
+       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  <jakub@redhat.com>
 
        PR c++/79664
index ce0443ca4c05e792ad3f600eaae30d2be497b57e..04f1c711b0cda40dfa92f3bfb2dd44c0ca859473 100644 (file)
@@ -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;
     }
 
index 3d79ba8e934356889702b1807ceb49cac76c6c8c..fc1d9eff240ae026ec1b099072298ede5fd124a6 100644 (file)
@@ -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;
index e1f99020bb0ec06ca43b5527e59970671a64f57d..39e8328464853e2913cfc22b23c7b5c6a1bce9b6 100644 (file)
@@ -1,6 +1,11 @@
 2017-05-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2017-03-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/79896
+       * g++.dg/ext/int128-5.C: New test.
+
        2017-03-09  Jakub Jelinek  <jakub@redhat.com>
 
        PR sanitizer/79944