From 7bf4b64c0ad3b1e12281a39a4b78b827dca2c6f8 Mon Sep 17 00:00:00 2001 From: Cary R Date: Wed, 29 Aug 2007 17:29:56 -0700 Subject: [PATCH] Check that logic gates are not given null ports. Logic gates do not handle null ports so check for this and issue an error message when it happens. --- elaborate.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/elaborate.cc b/elaborate.cc index e3b3463c..c61d033b 100644 --- a/elaborate.cc +++ b/elaborate.cc @@ -379,6 +379,12 @@ void PGBuiltin::elaborate(Design*des, NetScope*scope) const only. We do it early so that we can see if we can make a wide gate instead of an array of gates. */ + if (pin(0) == 0) { + cerr << get_line() << ": error: Logic gate port " + "expressions are not optional." << endl; + des->errors += 1; + return; + } NetNet*lval_sig = pin(0)->elaborate_lnet(des, scope, true); assert(lval_sig); @@ -536,6 +542,12 @@ void PGBuiltin::elaborate(Design*des, NetScope*scope) const for (unsigned idx = 0 ; idx < pin_count() ; idx += 1) { const PExpr*ex = pin(idx); + if (ex == 0) { + cerr << get_line() << ": error: Logic gate port " + "expressions are not optional." << endl; + des->errors += 1; + return; + } NetNet*sig = (idx == 0) ? lval_sig : ex->elaborate_net(des, scope, 0, 0, 0, 0); -- 2.11.4.GIT