From: ceriel Date: Fri, 14 May 1993 12:01:14 +0000 (+0000) Subject: A fix: make error_type usable as function type; prevents core dump on some inputs X-Git-Tag: release-5-5~323 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=4d1b0d34867148371dacab549a91f17135cbdcb3;p=ack.git A fix: make error_type usable as function type; prevents core dump on some inputs --- diff --git a/lang/cem/cemcom.ansi/code.c b/lang/cem/cemcom.ansi/code.c index 65790a30b..6a55fba51 100644 --- a/lang/cem/cemcom.ansi/code.c +++ b/lang/cem/cemcom.ansi/code.c @@ -263,11 +263,9 @@ begin_proc(ds, idf) /* to be called when entering a procedure */ func_name = name; if (def->df_type->tp_fund != FUNCTION) { error("making function body for non-function"); - func_type = error_type; - } - else { - func_type = def->df_type->tp_up; + def->df_type = error_type; } + func_type = def->df_type->tp_up; #ifdef LINT func_notypegiven = ds->ds_notypegiven; #endif diff --git a/lang/cem/cemcom.ansi/main.c b/lang/cem/cemcom.ansi/main.c index 09e19db0a..f279b0738 100644 --- a/lang/cem/cemcom.ansi/main.c +++ b/lang/cem/cemcom.ansi/main.c @@ -348,6 +348,7 @@ init() lngdbl_type = standard_type(LNGDBL, 0, lngdbl_align, lngdbl_size); void_type = standard_type(VOID, 0, 1, (arith)-1); error_type = standard_type(ERRONEOUS, 0, 1, (arith)1); + error_type->tp_up = error_type; /* Pointer Arithmetic type: all arithmetics concerning pointers is supposed to be performed in the