1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-20 05:29:39 +00:00

Don't check for circular references of imports that don't have matching exports.

This fix will avoid referring to a struct member through a null pointer.
This commit is contained in:
Greg King 2021-06-04 08:49:10 -04:00
parent d5d9183ccf
commit 39ef63cbbc

View File

@ -457,16 +457,14 @@ long GetExprVal (ExprNode* Expr)
static void GetSegExprValInternal (ExprNode* Expr, SegExprDesc* D, int Sign) static void GetSegExprValInternal (ExprNode* Expr, SegExprDesc* D, int Sign)
/* Check if the given expression consists of a segment reference and only /* Check if the given expression consists of a segment reference and only
** constant values, additions and subtractions. If anything else is found, ** constant values, additions, and subtractions. If anything else is found,
** set D->TooComplex to true. ** set D->TooComplex to true.
** Internal, recursive routine. ** Internal, recursive routine.
*/ */
{ {
Export* E; Export* E;
if (Expr == 0) { CHECK (Expr != 0);
return;
}
switch (Expr->Op) { switch (Expr->Op) {
@ -483,7 +481,7 @@ static void GetSegExprValInternal (ExprNode* Expr, SegExprDesc* D, int Sign)
*/ */
if (ExportHasMark (E)) { if (ExportHasMark (E)) {
CircularRefError (E); CircularRefError (E);
} else { } else if (E->Expr != 0) {
MarkExport (E); MarkExport (E);
GetSegExprValInternal (E->Expr, D, Sign); GetSegExprValInternal (E->Expr, D, Sign);
UnmarkExport (E); UnmarkExport (E);