gcc/c-family/ChangeLog:
PR middle-end/89294
* c-common.c (invalid_array_size_error): Handle cst_size_not_constant.
gcc/ChangeLog:
PR middle-end/89294
* tree.c (valid_constant_size_p): Avoid assuming size is a constant
expression.
* tree.h (cst_size_error): Add the cst_size_not_constant enumerator.
From-SVN: r268990
+2019-02-18 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/89294
+ * tree.c (valid_constant_size_p): Avoid assuming size is a constant
+ expression.
+ * tree.h (cst_size_error): Add the cst_size_not_constant enumerator.
+
2019-02-18 Richard Biener <rguenther@suse.de>
PR tree-optimization/89296
+2019-02-18 Martin Sebor <msebor@redhat.com>
+
+ PR middle-end/89294
+ * c-common.c (invalid_array_size_error): Handle cst_size_not_constant.
+
2019-02-16 David Malcolm <dmalcolm@redhat.com>
PR c++/88680
tree maxsize = max_object_size ();
switch (error)
{
+ case cst_size_not_constant:
+ if (name)
+ error_at (loc, "size of array %qE is not a constant expression",
+ name);
+ else
+ error_at (loc, "size of array is not a constant expression");
+ break;
case cst_size_negative:
if (name)
error_at (loc, "size %qE of array %qE is negative",
if (!perr)
perr = &error;
- if (TREE_OVERFLOW (size))
+ if (TREE_CODE (size) != INTEGER_CST)
+ {
+ *perr = cst_size_not_constant;
+ return false;
+ }
+
+ if (TREE_OVERFLOW_P (size))
{
*perr = cst_size_overflow;
return false;
is not a valid size. */
enum cst_size_error {
cst_size_ok,
+ cst_size_not_constant,
cst_size_negative,
cst_size_too_big,
cst_size_overflow