summaryrefslogtreecommitdiff
path: root/parse/infer.c
diff options
context:
space:
mode:
Diffstat (limited to 'parse/infer.c')
-rw-r--r--parse/infer.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/parse/infer.c b/parse/infer.c
index 725c4d3..6415cb3 100644
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -2645,6 +2645,7 @@ typesub(Node *n, int noerr)
{
char *name;
size_t i;
+ Node *l;
if (!n)
return;
@@ -2703,10 +2704,12 @@ typesub(Node *n, int noerr)
if (n->expr.param)
n->expr.param = tyfix(n, n->expr.param, 0);
typesub(n->expr.idx, noerr);
- if (exprop(n) == Ocast && exprop(n->expr.args[0]) == Olit &&
- n->expr.args[0]->expr.args[0]->lit.littype == Lint) {
- settype(n->expr.args[0], exprtype(n));
- settype(n->expr.args[0]->expr.args[0], exprtype(n));
+ if (exprop(n) == Ocast && exprop(n->expr.args[0]) == Olit) {
+ l = n->expr.args[0]->expr.args[0];
+ if(l->lit.littype == Lint && istyint(exprtype(n))) {
+ settype(n->expr.args[0], exprtype(n));
+ settype(n->expr.args[0]->expr.args[0], exprtype(n));
+ }
}
if (exprop(n) == Oauto)
adddispspecialization(n, curstab());