Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2003:
[Freeciv-Dev] Re: (PR#7009) Segfault in first turn
Home

[Freeciv-Dev] Re: (PR#7009) Segfault in first turn

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: ajmitch@xxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#7009) Segfault in first turn
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 1 Dec 2003 08:56:25 -0800
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=7009 >

Andrew Mitchell wrote:

> Running with valgrind, and hitting end turn:
> 
>>==14359== 
> 
> ==14359== Conditional jump or move depends on uninitialised value(s)
> ==14359==    at 0x80B2988: build_landarea_map_turn_0 (score.c:193)
> ==14359==    by 0x80B3033: build_landarea_map (score.c:312)
> ==14359==    by 0x80B349A: civ_score (score.c:433)
> ==14359==    by 0x809A7E7: make_history_report (report.c:1050)
> ==14359== 
> ==14359== Conditional jump or move depends on uninitialised value(s)
> ==14359==    at 0x80B29A1: build_landarea_map_turn_0 (score.c:197)
> ==14359==    by 0x80B3033: build_landarea_map (score.c:312)
> ==14359==    by 0x80B349A: civ_score (score.c:433)
> ==14359==    by 0x809A7E7: make_history_report (report.c:1050)
> ==14359== 
> ==14359== Use of uninitialised value of size 4
> ==14359==    at 0x80B29A9: build_landarea_map_turn_0 (score.c:198)
> ==14359==    by 0x80B3033: build_landarea_map (score.c:312)
> ==14359==    by 0x80B349A: civ_score (score.c:433)
> ==14359==    by 0x809A7E7: make_history_report (report.c:1050)
> ==14359== 
> ==14359== Invalid read of size 4
> ==14359==    at 0x80B29A9: build_landarea_map_turn_0 (score.c:198)
> ==14359==    by 0x80B3033: build_landarea_map (score.c:312)
> ==14359==    by 0x80B349A: civ_score (score.c:433)
> ==14359==    by 0x809A7E7: make_history_report (report.c:1050)
> ==14359==    Address 0x20656D65 is not stack'd, malloc'd or free'd
> Segmentation fault

Try running with this patch, and send us the output.

jason

Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.152
diff -u -r1.152 map.c
--- common/map.c        2003/11/28 17:37:21     1.152
+++ common/map.c        2003/12/01 16:55:22
@@ -251,7 +251,7 @@
 **************************************************************************/
 void map_allocate(void)
 {
-  freelog(LOG_DEBUG, "map_allocate (was %p) (%d,%d)",
+  freelog(LOG_NORMAL, "map_allocate (was %p) (%d,%d)",
          map.tiles, map.xsize, map.ysize);
 
   assert(map.tiles == NULL);
Index: server/score.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/score.c,v
retrieving revision 1.4
diff -u -r1.4 score.c
--- server/score.c      2003/10/24 00:23:33     1.4
+++ server/score.c      2003/12/01 16:55:22
@@ -171,6 +171,7 @@
   } players_iterate_end;
 }
 
+#include "log.h"
 /**************************************************************************
   0th turn: install starting points, counting their tiles
 **************************************************************************/
@@ -186,6 +187,9 @@
 
   whole_map_iterate(x, y) {
     int i = map_pos_to_index(x, y);
+
+    freelog(LOG_NORMAL, "%d,%d : %d,%d : %d",
+           map.xsize, map.ysize, x, y, i);
 
     pclaim = &pcmap->claims[i];
     ptile = &map.tiles[i];

[Prev in Thread] Current Thread [Next in Thread]