+ op->op = IR_OP_LOAD;
+ op->data_type = IR_DATA_FIELD_REF_INDEX;
+ op->signedness = IR_SIGN_DYN;
+ op->side = side;
+ op->u.load.u.ref_index.symbol = strdup(string);
+ if (!op->u.load.u.ref_index.symbol) {
+ goto error;
+ }
+ /* Only positive integer literals accepted as index. */
+ if (next->type == NODE_UNARY_OP) {
+ fprintf(stderr, "[error] Unexpected unary operator as index\n");
+ goto error;
+ }
+ if (next->type != NODE_EXPRESSION) {
+ fprintf(stderr, "[error] Expecting expression as index\n");
+ goto error;
+ }
+ if (next->u.expression.type != AST_EXP_CONSTANT) {
+ fprintf(stderr, "[error] Expecting constant index\n");
+ goto error;
+ }
+ if (next->u.expression.u.constant < 0) {
+ fprintf(stderr, "[error] Expecting positive constant index\n");
+ goto error;