<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40610 >

2009/2/14 Chris Snook:
>
> I'm using freeciv-2.1.8-1.fc10.i386 from Fedora 10, and it disconnects
> from the server (because the server is crashing) as soon as I make a
> city, and sometimes when exploring a village (presumably when that
> village ends up being a friendly city).

 This definitely looks like gcc -bug. Attached workaround patch fixed
it for me on virtual Fedora 10 server.

 I have not managed to reproduce this problem on Debian or Ubuntu systems.


 - ML

diff -Nurd -X.diff_ignore freeciv/common/aicore/cm.c freeciv/common/aicore/cm.c
--- freeciv/common/aicore/cm.c  2009-01-22 13:16:18.000000000 +0200
+++ freeciv/common/aicore/cm.c  2009-02-23 20:53:32.000000000 +0200
@@ -1047,6 +1047,11 @@
      swoop at the end, in order to avoid memory errors.  */
   tile_type_vector_init(&tofree);
 
+  /* This freelog() is workaround for waht seems like gcc optimization
+   * bug. If lattice->size is not accessed before for -loop, its value
+   * is considered <= 0 in loop ending condition.
+   * This applies to -O2 optimization on some distributions. */
+  freelog(LOG_DEBUG, "Lattice: %d", lattice->size);
   for (i = 0, j = 0; i < lattice->size; i++) {
     struct cm_tile_type *ptype = lattice->p[i];
 
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to