PR c++/91545 - ICE in constexpr store evaluation.
authorMarek Polacek <mpolacek@gcc.gnu.org>
Mon, 26 Aug 2019 14:39:08 +0000 (14:39 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Mon, 26 Aug 2019 14:39:08 +0000 (14:39 +0000)
* constexpr.c (cxx_eval_store_expression): Check FIELD_DECL instead
of DECL_P.

* g++.dg/cpp0x/pr91545.C: New test.

From-SVN: r274930

gcc/cp/ChangeLog
gcc/cp/constexpr.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/pr91545.C [new file with mode: 0644]

index 013de12..f0eb35c 100644 (file)
@@ -1,3 +1,9 @@
+2019-08-26  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/91545 - ICE in constexpr store evaluation.
+       * constexpr.c (cxx_eval_store_expression): Check FIELD_DECL instead
+       of DECL_P.
+
 2019-08-24  Nathan Sidwell  <nathan@acm.org>
 
        * class.c (check_for_overrides): Conversion operators need
index dbd0dc3..6c547d6 100644 (file)
@@ -3849,7 +3849,7 @@ cxx_eval_store_expression (const constexpr_ctx *ctx, tree t,
          {
            tree ob = TREE_OPERAND (probe, 0);
            tree elt = TREE_OPERAND (probe, 1);
-           if (DECL_P (elt) && DECL_MUTABLE_P (elt))
+           if (TREE_CODE (elt) == FIELD_DECL && DECL_MUTABLE_P (elt))
              mutable_p = true;
            if (evaluated
                && modifying_const_object_p (TREE_CODE (t), probe, mutable_p)
index b5a2d7b..fab9d33 100644 (file)
@@ -1,3 +1,8 @@
+2019-08-26  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/91545 - ICE in constexpr store evaluation.
+       * g++.dg/cpp0x/pr91545.C: New test.
+
 2019-08-26  Tejas Joshi  <tejasjoshi9673@gmail.com>
 
        * gcc.target/i386/sse4_1-round-roundeven-1.c: New test.
@@ -5,8 +10,8 @@
 
 2019-08-26  Tejas Joshi  <tejasjoshi9673@gmail.com>
 
-        * gcc.dg/torture/builtin-round-roundeven.c: New test.
-        * gcc.dg/torture/builtin-round-roundevenf128.c: Likewise.
+       * gcc.dg/torture/builtin-round-roundeven.c: New test.
+       * gcc.dg/torture/builtin-round-roundevenf128.c: Likewise.
 
 2019-08-26  Robin Dapp  <rdapp@linux.ibm.com>
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr91545.C b/gcc/testsuite/g++.dg/cpp0x/pr91545.C
new file mode 100644 (file)
index 0000000..2aa1fa1
--- /dev/null
@@ -0,0 +1,5 @@
+// PR c++/91545
+// { dg-do compile { target c++11 } }
+
+long a[1];
+int d, e { d && (a[d] = 0) };