From d3544ff534be7dcdf92e40d03d9601d816016420 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 1 Jul 2009 22:04:11 -0700 Subject: [PATCH] outobj: handle the case of SEG in pass 0 SEG 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 --- output/outobj.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/output/outobj.c b/output/outobj.c index c9e05c34..a3f55801 100644 --- a/output/outobj.c +++ b/output/outobj.c @@ -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 */ -- 2.11.4.GIT