summaryrefslogtreecommitdiff
path: root/parse/fold.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-07-29 02:05:12 -0400
committerOri Bernstein <ori@eigenstate.org>2016-07-29 02:05:12 -0400
commitce56b7eacc56b427ba673829b0b35b933e3f2cda (patch)
tree3de01183a7e43404721641e3b43eb372f1acba46 /parse/fold.c
parent359f5e7e727145aeebae62563afbbe031257ea21 (diff)
downloadmc-ce56b7eacc56b427ba673829b0b35b933e3f2cda.tar.gz
Fix a bit of undefined behavior.
Diffstat (limited to 'parse/fold.c')
-rw-r--r--parse/fold.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/parse/fold.c b/parse/fold.c
index 8c58312..6139293 100644
--- a/parse/fold.c
+++ b/parse/fold.c
@@ -153,7 +153,7 @@ Node *fold(Node *n, int foldvar)
if (isintval(args[1], 0))
r = args[0];
if (getintlit(args[0], &a) && getintlit(args[1], &b))
- r = val(n->loc, a - b, exprtype(n));
+ r = val(n->loc, (uint64_t)a - b, exprtype(n));
break;
case Omul:
/* 1 * x = x */
@@ -198,7 +198,7 @@ Node *fold(Node *n, int foldvar)
break;
case Obsl:
if (getintlit(args[0], &a) && getintlit(args[1], &b))
- r = val(n->loc, a << b, exprtype(n));
+ r = val(n->loc, (uint64_t)a << b, exprtype(n));
break;
case Obsr:
if (getintlit(args[0], &a) && getintlit(args[1], &b))