cc: dont' try compiling invalid code

When we have errors in the code, passing it on to the backend
just generates cryptic or incorrect errors, and in some case,
crashes as we try to process trees with missing labels, or
which are malformed in other ways.

Instead, bail out of codgen() and don't even try.
This commit is contained in:
Ori Bernstein 2024-12-01 22:37:14 +00:00
parent 7d13427ccf
commit 0518041867

View file

@ -11,6 +11,11 @@ codgen(Node *n, Node *nn)
maxargsafe = 0;
hasdoubled = 0;
/*
* no point in giving invalid code to the backend.
*/
if(nerrors != 0)
return;
/*
* isolate name
*/