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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230886
138bc75d-0d04-0410-961f-
82ee72b054a4
+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"
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");
+2015-11-25 Markus Trippelsdorf <markus@trippelsdorf.de>
+ Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/68087
+ * g++.dg/cpp0x/constexpr-array13.C: New.
+
2015-11-25 Ilmir Usmanov <me@ilmir.us>
Cesar Philippidis <cesar@codesourcery.com>
--- /dev/null
+// PR c++/68087
+// { dg-do compile { target c++11 } }
+
+constexpr char c[] = "hello";
+constexpr const char *p = c;
+constexpr char ch = *(p-1); // { dg-error "negative array subscript" }