From 09a80e9e13989678ca851f7d25e7bdf7c7f36067 Mon Sep 17 00:00:00 2001 From: ceriel Date: Fri, 12 Jun 1992 09:03:07 +0000 Subject: [PATCH] Fixed checking of unary '*' --- lang/cem/cemcom.ansi/ch3mon.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/lang/cem/cemcom.ansi/ch3mon.c b/lang/cem/cemcom.ansi/ch3mon.c index ebfb899ff..0148e006b 100644 --- a/lang/cem/cemcom.ansi/ch3mon.c +++ b/lang/cem/cemcom.ansi/ch3mon.c @@ -45,21 +45,26 @@ ch3mon(oper, expp) } else { expr = *expp; + if (expr->ex_type->tp_up->tp_fund != FUNCTION && + expr->ex_type->tp_up->tp_size <= 0) { + expr_error(expr, "incomplete type in expression"); + } if (is_ld_cst(expr)) /* dereference in administration only */ expr->ex_type = expr->ex_type->tp_up; else /* runtime code */ *expp = new_oper(expr->ex_type->tp_up, NILEXPR, '*', expr); - (*expp)->ex_lvalue = ( - (*expp)->ex_type->tp_fund != ARRAY && - (*expp)->ex_type->tp_fund != FUNCTION + expr = *expp; + expr->ex_lvalue = ( + expr->ex_type->tp_fund != ARRAY && + expr->ex_type->tp_fund != FUNCTION ); - if ((*expp)->ex_type->tp_typequal & TQ_CONST) - (*expp)->ex_flags |= EX_READONLY; - if ((*expp)->ex_type->tp_typequal & TQ_VOLATILE) - (*expp)->ex_flags |= EX_VOLATILE; - (*expp)->ex_flags &= ~EX_ILVALUE; + if (expr->ex_type->tp_typequal & TQ_CONST) + expr->ex_flags |= EX_READONLY; + if (expr->ex_type->tp_typequal & TQ_VOLATILE) + expr->ex_flags |= EX_VOLATILE; + expr->ex_flags &= ~EX_ILVALUE; } break; case ADDRESSOF: -- 2.34.1