summaryrefslogtreecommitdiff
path: root/parse
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-01-25 14:35:28 -0800
committerOri Bernstein <ori@eigenstate.org>2015-01-25 14:35:28 -0800
commitec59fa9433c77df1f4eefd9167694177446b432c (patch)
tree75bb6fc8c0393f624fe76c5edd5377fc867378ba /parse
parent3426a0868cf03119797fbf84e2685cdd8905c7d9 (diff)
downloadmc-ec59fa9433c77df1f4eefd9167694177446b432c.tar.gz
Clear structs.
When creating stack structs, clear them. TODO: only clear uninitialized values.
Diffstat (limited to 'parse')
-rw-r--r--parse/infer.c4
-rw-r--r--parse/ops.def29
2 files changed, 17 insertions, 16 deletions
diff --git a/parse/infer.c b/parse/infer.c
index 842da18..1e0b939 100644
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -1375,13 +1375,13 @@ static void inferexpr(Inferstate *st, Node **np, Type *ret, int *sawret)
break;
case Obad: case Ocjmp: case Ojtab: case Oset:
case Oslbase: case Osllen: case Outag:
- case Oblit: case Numops:
+ case Oblit: case Oclear: case Oudata:
case Otrunc: case Oswiden: case Ozwiden:
case Oint2flt: case Oflt2int: case Oflt2flt:
case Ofadd: case Ofsub: case Ofmul: case Ofdiv: case Ofneg:
case Ofeq: case Ofne: case Ofgt: case Ofge: case Oflt: case Ofle:
case Oueq: case Oune: case Ougt: case Ouge: case Oult: case Oule:
- case Oudata:
+ case Numops:
die("Should not see %s in fe", opstr[exprop(n)]);
break;
}
diff --git a/parse/ops.def b/parse/ops.def
index fed7bd4..56b9bc5 100644
--- a/parse/ops.def
+++ b/parse/ops.def
@@ -56,24 +56,25 @@ O(Ostruct, 1, OTmisc, NULL)
O(Oarr, 1, OTmisc, NULL)
/* all below this point are backend-only */
-O(Ocjmp, 1, OTmisc, NULL) /* conditional jump */
-O(Ojtab, 1, OTmisc, NULL) /* jump table */
-O(Oset, 1, OTbin, "=") /* store to var */
-O(Osllen, 1, OTpre, "SLLEN") /* size of slice */
-O(Oslbase, 1, OTpre, "SLBASE") /* base of sice */
-O(Outag, 1, OTpre, "UTAG") /* tag of union */
-O(Oudata, 1, OTpre, "UDATA") /* pointer to contents of union */
-O(Oblit, 1, OTbin, "BLIT") /* blit memory */
+O(Ocjmp, 1, OTmisc, NULL) /* conditional jump */
+O(Ojtab, 1, OTmisc, NULL) /* jump table */
+O(Oset, 1, OTbin, "=") /* store to var */
+O(Osllen, 1, OTpre, "SLLEN") /* size of slice */
+O(Oslbase, 1, OTpre, "SLBASE") /* base of sice */
+O(Outag, 1, OTpre, "UTAG") /* tag of union */
+O(Oudata, 1, OTpre, "UDATA") /* pointer to contents of union */
+O(Oblit, 1, OTbin, "BLIT") /* blit memory */
+O(Oclear, 1, OTpre, "CLEAR") /* zero */
/* integer conversions */
-O(Otrunc, 1, OTmisc, NULL) /* truncating cast */
-O(Ozwiden, 1, OTmisc, NULL) /* zero-extending widening cast */
-O(Oswiden, 1, OTmisc, NULL) /* sign-extending widening cast */
+O(Otrunc, 1, OTmisc, NULL) /* truncating cast */
+O(Ozwiden, 1, OTmisc, NULL) /* zero-extending widening cast */
+O(Oswiden, 1, OTmisc, NULL) /* sign-extending widening cast */
/* float conversions */
-O(Oflt2int, 1, OTmisc, NULL) /* float to int conversion */
-O(Oint2flt, 1, OTmisc, NULL) /* int to float conversion */
-O(Oflt2flt, 1, OTmisc, NULL) /* flt32<->flt64 conversion */
+O(Oflt2int, 1, OTmisc, NULL) /* float to int conversion */
+O(Oint2flt, 1, OTmisc, NULL) /* int to float conversion */
+O(Oflt2flt, 1, OTmisc, NULL) /* flt32<->flt64 conversion */
/* floating arithmetic */
O(Ofadd, 1, OTmisc, NULL)