outobj: handle the case of SEG <undefined> in pass 0

SEG <undefined> can happen, validly, for a common symbol during the
optimization passes.  It better not happen during the real passes,
however!

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin 2009-07-01 22:04:11 -07:00
parent 807bed5ffd
commit d3544ff534

View file

@ -1808,14 +1808,22 @@ static int32_t obj_segbase(int32_t segment)
}
if (eb) {
e = eb->exts[i];
if (e->defwrt_type == DEFWRT_NONE)
if (!e) {
nasm_assert(pass0 == 0);
/* Not available - can happen during optimization */
return NO_SEG;
}
switch (e->defwrt_type) {
case DEFWRT_NONE:
return segment; /* fine */
else if (e->defwrt_type == DEFWRT_SEGMENT)
case DEFWRT_SEGMENT:
return e->defwrt_ptr.seg->index + 1;
else if (e->defwrt_type == DEFWRT_GROUP)
case DEFWRT_GROUP:
return e->defwrt_ptr.grp->index + 1;
else
default:
return NO_SEG; /* can't tell what it is */
}
}
return segment; /* not one of ours - leave it alone */