aboutsummaryrefslogtreecommitdiff
path: root/semantics.c
diff options
context:
space:
mode:
Diffstat (limited to 'semantics.c')
-rw-r--r--semantics.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/semantics.c b/semantics.c
index 2871e9c..f404fb5 100644
--- a/semantics.c
+++ b/semantics.c
@@ -1179,6 +1179,7 @@ ExpType semantics_exp(CNode *p, CScope_t scope) {
}
}
break;
+ case NOP: ; break;
default: assert(0);
}
p->ext.type = res.type;
@@ -1214,7 +1215,7 @@ CVar_t semantics_for(CNode *p, CScope_t scope) {
semantics_exp(p->chd, scope);
semantics_exp(p->chd->next->next, scope);
CVar_t res;
- if (!IS_SCALAR(exp.type->type))
+ if (p->chd->next->type != NOP && !IS_SCALAR(exp.type->type))
{
sprintf(err_buff, "a scalar is required in 'for' condition");
ERROR(p->chd->next);
@@ -1247,7 +1248,7 @@ CVar_t semantics_check_loop(CNode *p, CScope_t scope, const char *stmt_name) {
if (!scope->inside_loop)
{
sprintf(err_buff, "%s statement not within a loop", stmt_name);
- ERROR(p->chd);
+ ERROR(p);
}
return NULL;
}