[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] Arraybound checking on Tru64 not working anymore
From: |
Teun Burgers |
Subject: |
[gnugo-devel] Arraybound checking on Tru64 not working anymore |
Date: |
Sun, 18 Jan 2004 12:02:31 +0100 |
User-agent: |
Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) |
I was trying to run 3.5.3 with arraybound checking on
Tru64. It won't run however since it already chokes on
this assignment in readconnect.c
struct heap_entry **heap = conn->heap - 1
The attached patch fixes this, but perhaps someone
has a more elegant fix for this issue.
Teun
--- gnugo-3.5.3.orig/engine/readconnect.c 2003-11-29 16:41:28.000000000
+0100
+++ gnugo-3.5.3/engine/readconnect.c 2004-01-12 15:22:03.000000000 +0100
@@ -3067,7 +3067,7 @@
int k;
int parent;
struct heap_entry *new_entry = &conn->heap_data[conn->heap_data_size];
- struct heap_entry **heap = conn->heap - 1;
+ struct heap_entry **heap = conn->heap;
gg_assert(conn->heap_data_size < 4 * BOARDMAX);
gg_assert(conn->heap_size < BOARDMAX);
@@ -3084,13 +3084,13 @@
for (k = conn->heap_size; k > 1; k = parent) {
parent = k / 2;
- if (heap[parent]->distance <= distance)
+ if (heap[parent-1]->distance <= distance)
break;
- heap[k] = heap[parent];
+ heap[k-1] = heap[parent-1];
}
- heap[k] = new_entry;
+ heap[k-1] = new_entry;
}
@@ -3099,19 +3099,19 @@
{
int k;
int child;
- struct heap_entry **heap = conn->heap - 1;
+ struct heap_entry **heap = conn->heap;
for (k = 1; 2 * k < conn->heap_size; k = child) {
child = 2 * k;
- if (heap[child]->distance > heap[child + 1]->distance)
+ if (heap[child-1]->distance > heap[child]->distance)
child++;
- if (heap[child]->distance >= heap[conn->heap_size]->distance)
+ if (heap[child-1]->distance >= heap[conn->heap_size-1]->distance)
break;
- heap[k] = heap[child];
+ heap[k-1] = heap[child-1];
}
- heap[k] = heap[conn->heap_size];
+ heap[k-1] = heap[conn->heap_size-1];
conn->heap_size--;
}
- [gnugo-devel] Arraybound checking on Tru64 not working anymore,
Teun Burgers <=