aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMarkus Trippelsdorf <markus@trippelsdorf.de>2015-11-25 16:40:16 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2015-11-25 16:40:16 +0000
commitc2127564efc152de34ea1a15ce9b20e8ddccfc2c (patch)
tree7a0e71f5c6fe1fafc9254a12eca779ae7728bc8d /gcc/cp
parent8e2d104ba2f4f89d6479d03f75cc374484875fc7 (diff)
downloadgcc-c2127564efc152de34ea1a15ce9b20e8ddccfc2c.zip
gcc-c2127564efc152de34ea1a15ce9b20e8ddccfc2c.tar.gz
gcc-c2127564efc152de34ea1a15ce9b20e8ddccfc2c.tar.bz2
re PR c++/68087 (ICE with constexpr in array with negative index)
/cp 2015-11-25 Markus Trippelsdorf <markus@trippelsdorf.de> Paolo Carlini <paolo.carlini@oracle.com> PR c++/68087 * constexpr.c (cxx_eval_array_reference): Use tree_fits_shwi_p before tree_to_shwi to avoid ICEs. /testsuite 2015-11-25 Markus Trippelsdorf <markus@trippelsdorf.de> Paolo Carlini <paolo.carlini@oracle.com> PR c++/68087 * g++.dg/cpp0x/constexpr-array13.C: New. Co-Authored-By: Paolo Carlini <paolo.carlini@oracle.com> From-SVN: r230886
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/constexpr.c4
2 files changed, 9 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a4aa01e..c94ae5f 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2015-11-25 Markus Trippelsdorf <markus@trippelsdorf.de>
+ Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/68087
+ * constexpr.c (cxx_eval_array_reference): Use tree_fits_shwi_p before
+ tree_to_shwi to avoid ICEs.
+
2015-11-24 Ilya Verbin <ilya.verbin@intel.com>
* parser.c (cp_parser_oacc_declare): Replace "ifdef ENABLE_OFFLOADING"
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 459173de..42e9902 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -1799,8 +1799,8 @@ cxx_eval_array_reference (const constexpr_ctx *ctx, tree t,
gcc_unreachable ();
}
- i = tree_to_shwi (index);
- if (i < 0)
+ if (!tree_fits_shwi_p (index)
+ || (i = tree_to_shwi (index)) < 0)
{
if (!ctx->quiet)
error ("negative array subscript");