allow rel_def_op relocs to point just past the end of the code. needed for

jump tables.
This commit is contained in:
Bill Currie 2003-07-24 17:51:24 +00:00
parent 01594e239e
commit 5962900e25
2 changed files with 8 additions and 3 deletions

View file

@ -51,6 +51,8 @@ typedef struct reloc_s {
struct reloc_s *next;
int ofs;
reloc_type type;
int line;
string_t file;
} reloc_t;
struct statement_s;

View file

@ -100,9 +100,10 @@ relocate_refs (reloc_t *refs, int ofs)
pr.code->code[refs->ofs].c = o;
break;
case rel_def_op:
if (ofs >= pr.code->size)
error (0, "invalid statement offset");
else
if (ofs > pr.code->size) {
error (0, "invalid statement offset: %d >= %d, %d",
ofs, pr.code->size, refs->ofs);
} else
G_INT (refs->ofs) = ofs;
break;
case rel_def_def:
@ -126,6 +127,8 @@ new_reloc (int ofs, reloc_type type)
ALLOC (16384, reloc_t, refs, ref);
ref->ofs = ofs;
ref->type = type;
ref->line = pr.source_line;
ref->file = pr.source_file;
return ref;
}