[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] crash
From: |
Paul Pogonyshev |
Subject: |
Re: [gnugo-devel] crash |
Date: |
Tue, 18 Nov 2003 02:05:22 +0000 |
User-agent: |
KMail/1.5.93 |
Gunnar wrote:
> I wrote:
> > This is extremely bad. The crash happens when reading the constraint
> > for the small avalanche joseki, pattern JK68 in komoku.db. It turns
> > out that the computed vertices used in the constraint come out all
> > wrong. It looks like the constraint callback might be called with the
> > wrong transformation number from do_corner_matchpat(), or at least
> > with a transformation number which isn't consistent with the pattern
> > that has been matched.
>
> The appended patch implements a quick and dirty workaround to get the
> right transformation number, awaiting a proper fix.
>
> - temporary workaround for a bug in do_corner_matchpat()
The patch below fixes the bug in a proper way. The problem actually
originated in `mkpat.c' and the matcher itself is working just fine.
It's not much of a surprise -- `mkpat.c' is in terrible conditions
with all the quick hacks stacked one on another.
Gunnar has confirmed that the patch fixes the posted test -- the
labels are in the correct positions for all transformations now.
The patch is already in CVS. I have also taken out Gunnar's
workaround.
Paul
--- mkpat.c.~1.126.~ 2003-11-15 02:58:10.000000000 +0000
+++ mkpat.c 2003-11-18 00:43:35.000000000 +0000
@@ -429,6 +429,7 @@ static dfa_t dfa;
static dfa_patterns dfa_pats;
static int transformation_hint;
+static int labels_transformation = 0;
struct hint_data {
@@ -642,6 +643,8 @@ write_to_dfa(int index)
}
if (dfa_verbose > 2)
dump_dfa(stderr, &dfa);
+
+ labels_transformation = transformation_hint;
}
else {
int ll;
@@ -1592,7 +1595,7 @@ finish_constraint_and_action(void)
TRANSFORM2(label_coords[c][0] - ci - movei,
label_coords[c][1] - cj - movej, &x, &y,
- transformation_hint);
+ labels_transformation);
code_pos += sprintf(code_pos,
"\n %c = AFFINE_TRANSFORM(%d, trans, move);",
c, OFFSET(x, y));
@@ -2442,6 +2445,9 @@ corner_add_pattern(void)
move_x = I(move_pos);
move_y = J(move_pos);
+ /* We need to transform labels as well. */
+ labels_transformation = trans;
+
/* Find all pattern elements. */
for (k = 0; k < el; k++) {
if (elements[k].att == ATT_X || elements[k].att == ATT_O) {