summaryrefslogtreecommitdiff
path: root/compiler_and_linker/unsorted/LoopDetection.c
diff options
context:
space:
mode:
authorAsh Wolf <ninji@wuffs.org>2023-01-14 13:20:48 +0000
committerAsh Wolf <ninji@wuffs.org>2023-01-14 13:20:48 +0000
commit5f3c8265f2717f72d68d8eb170fbe2dd114d7b76 (patch)
tree9c35e496749b61b40c2c18626eb45bde75d74d06 /compiler_and_linker/unsorted/LoopDetection.c
parent00edfdb0d430d8bf1d2fc98cb226114ef271d993 (diff)
downloadMWCC-5f3c8265f2717f72d68d8eb170fbe2dd114d7b76.tar.gz
MWCC-5f3c8265f2717f72d68d8eb170fbe2dd114d7b76.zip
fix lots more bugs, add better logging
Diffstat (limited to 'compiler_and_linker/unsorted/LoopDetection.c')
-rw-r--r--compiler_and_linker/unsorted/LoopDetection.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler_and_linker/unsorted/LoopDetection.c b/compiler_and_linker/unsorted/LoopDetection.c
index f1513e0..6bb2d51 100644
--- a/compiler_and_linker/unsorted/LoopDetection.c
+++ b/compiler_and_linker/unsorted/LoopDetection.c
@@ -281,11 +281,11 @@ void insertpreheaderblock(Loop *loop) {
} else if (pcode27->op == PC_BCTR) {
if (pcode27->argCount > 1 && pcode27->args[1].kind == PCOp_MEMORY) {
Object *obj = pcode27->args[1].data.mem.obj;
- PCodeLabel **array = (PCodeLabel **) obj->u.data.u.switchtable.data;
+ UInt32 *array = (UInt32 *) obj->u.data.u.switchtable.data;
int i;
for (i = 0; i < obj->u.data.u.switchtable.size; i++) {
- if (array[i]->block == block28)
- array[i] = preheader->labels;
+ if (((PCodeLabel *) CTool_ResolveIndexToPointer(array[i]))->block == block28)
+ array[i] = CTool_CreateIndexFromPointer(preheader->labels);
}
} else {
CodeLabelList *cll;