Don't treat initialized non-consts as static array indices

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-11-30 16:25:18 +01:00
parent 6acd159c9c
commit 696a8629b3

2
ast.c
View file

@ -2025,7 +2025,7 @@ bool ast_array_index_codegen(ast_array_index *self, ast_function *func, bool lva
arr = (ast_value*)self->array;
idx = (ast_value*)self->index;
if (!ast_istype(self->index, ast_value) || !idx->hasvalue) {
if (!ast_istype(self->index, ast_value) || !idx->hasvalue || idx->cvq != CV_CONST) {
/* Time to use accessor functions */
ast_expression_codegen *cgen;
ir_value *iridx, *funval;