code: plan9front

Download patch

ref: 613fd6b4294ad3277a91c9a2e58b2b2d4f22ab1c
parent: 5664fb3540ae0dccec628720574520122193ab1b
author: Jacob Moody <moody@posixcafe.org>
date: Fri Mar 17 18:08:14 EDT 2023

cc: fix suicide with undefined function arguments

_Noreturn change introduced a check on the type
for OFUNC. This will be nil in the event that a
symbol given as a function argument is undefined.

--- a/sys/src/cmd/cc/pgen.c
+++ b/sys/src/cmd/cc/pgen.c
@@ -168,7 +168,7 @@
 	case OFUNC:
 		complex(n);
 		cgen(n, Z);
-		if((n->type->garb & GNORET) == 0)
+		if(n->type == nil || (n->type->garb & GNORET) == 0)
 			break;
 
 		canreach = 0;