Do not crash if the expression of an array designator is not constant.
authorChristoph Mallon <christoph.mallon@gmx.de>
Sun, 20 May 2012 16:53:23 +0000 (18:53 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Sun, 20 May 2012 16:53:23 +0000 (18:53 +0200)
parser.c

index 0a0cdf6..fc156f4 100644 (file)
--- a/parser.c
+++ b/parser.c
@@ -1829,7 +1829,8 @@ static bool walk_designator(type_path_t *path, const designator_t *designator,
                        }
                } else {
                        expression_t *array_index = designator->array_index;
-                       assert(designator->array_index != NULL);
+                       if (is_constant_expression(array_index) != EXPR_CLASS_CONSTANT)
+                               return true;
 
                        if (!is_type_array(type)) {
                                if (is_type_valid(type)) {