diff options
| author | 2022-08-04 22:36:59 +0200 | |
|---|---|---|
| committer | 2022-08-04 22:36:59 +0200 | |
| commit | 0fec7de747d93586eda66ce190f5f3d6715421a4 (patch) | |
| tree | 2c6db93b3e6d3299d530cea20dd6468cf47b43c2 /bootstrap/fold.c | |
| parent | 4b2451500b8f085321a041ebc13761a5102f0e6d (diff) | |
struct,unions, compound literals; mostly
Diffstat (limited to 'bootstrap/fold.c')
| -rw-r--r-- | bootstrap/fold.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bootstrap/fold.c b/bootstrap/fold.c index f7962d4..efe1f83 100644 --- a/bootstrap/fold.c +++ b/bootstrap/fold.c @@ -238,6 +238,17 @@ fas(struct expr *ex) { free(child); } +static void +fzeroini(struct expr *ex) { + const struct type *ty = ex->ty; + if (ty->t == TYint || ty->t == TYfloat || ty->t == TYbool || ty->t == TYenum) { + ex->i = 0; + numcast(ex, ty); + if (ty->t == TYenum) + trysetenumvname(ex); + } +} + int fold(struct expr *ex) { switch (ex->t) { @@ -261,6 +272,8 @@ fold(struct expr *ex) { case Eas: fas(ex); break; + case Ezeroini: + fzeroini(ex); default: break; } |