From 8d25f69e77847aa074fbf71031476cb1b6da886e Mon Sep 17 00:00:00 2001 From: ceriel Date: Mon, 30 Sep 1991 15:00:46 +0000 Subject: [PATCH] Fix: sometimes crashed on initializers for unknown types --- lang/cem/cemcom.ansi/ival.g | 11 +++++++++++ lang/cem/cemcom/ival.g | 10 ++++++++++ lang/cem/cemcom/proto.make | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lang/cem/cemcom.ansi/ival.g b/lang/cem/cemcom.ansi/ival.g index 1d7ed0730..454343bc6 100644 --- a/lang/cem/cemcom.ansi/ival.g +++ b/lang/cem/cemcom.ansi/ival.g @@ -140,6 +140,9 @@ gen_tpcheck(tpp) if (! valid_type(tp, "union")) gen_error = pack_level; break; + case ERRONEOUS: + if (! gen_error) gen_error = pack_level; + break; } } @@ -252,6 +255,9 @@ gen_tphead(tpp, nest) return gen_tphead(&(sd->sd_type), 1); } return &(sd->sd_type); + case ERRONEOUS: + if (! gen_error) gen_error = pack_level; + /* fall through */ default: p->nelem = 1; p->elem_count = 1; @@ -273,6 +279,9 @@ gen_tpmiddle() again: tp = *(p->s_tpp); switch(tp->tp_fund) { + case ERRONEOUS: + if (! gen_error) gen_error = pack_level; + return p->s_tpp; default: if (p->elem_count == p->nelem && p->s_nested) { p = p->next; @@ -556,6 +565,8 @@ and also to prevent runtime coercions for compile-time constants. #endif NOBITFIELD case ERRONEOUS: + if (! gen_error) gen_error = pack_level; + /* fall through */ case VOID: break; default: diff --git a/lang/cem/cemcom/ival.g b/lang/cem/cemcom/ival.g index f13b89a46..5c05650dd 100644 --- a/lang/cem/cemcom/ival.g +++ b/lang/cem/cemcom/ival.g @@ -134,6 +134,9 @@ gen_tpcheck(tpp, union_allowed) if (! valid_type(tp, "union")) gen_error = pack_level; break; + case ERRONEOUS: + if (! gen_error) gen_error = pack_level; + break; } } @@ -243,6 +246,9 @@ gen_tphead(tpp, nest) return gen_tphead(&(sd->sd_type), 1); } return &(sd->sd_type); + case ERRONEOUS: + if (! gen_error) gen_error = pack_level; + /* fall through */ default: p->nelem = 1; p->elem_count = 1; @@ -264,6 +270,9 @@ gen_tpmiddle() again: tp = *(p->s_tpp); switch(tp->tp_fund) { + case ERRONEOUS: + if (! gen_error) gen_error = pack_level; + return p->s_tpp; default: if (p->elem_count == p->nelem && p->s_nested) { p = p->next; @@ -544,6 +553,7 @@ and also to prevent runtime coercions for compile-time constants. #endif NOBITFIELD case ERRONEOUS: + if (! gen_error) gen_error = pack_level; break; default: crash("check_ival"); diff --git a/lang/cem/cemcom/proto.make b/lang/cem/cemcom/proto.make index 7049d4d24..e0696bc25 100644 --- a/lang/cem/cemcom/proto.make +++ b/lang/cem/cemcom/proto.make @@ -96,7 +96,7 @@ GEN_H = botch_free.h dataflow.h debug.h density.h errout.h \ regcount.h \ code.h declar.h decspecs.h def.h expr.h field.h estack.h util.h \ idf.h macro.h stmt.h struct.h switch.h type.h l_brace.h l_state.h \ - l_outdef.h stack.h + l_outdef.h stack.h lapbuf.h noRoption.h nofloat.h HFILES= $(GEN_H) $(SRC_H)