Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2001:
[Freeciv-Dev] Assert for ZOC failed in ai/aiunit.c (PR#909)
Home

[Freeciv-Dev] Assert for ZOC failed in ai/aiunit.c (PR#909)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Assert for ZOC failed in ai/aiunit.c (PR#909)
From: rwetmore#sympatico.ca@xxxxxxxxxxxxxxxxxxx
Date: Sat, 25 Aug 2001 07:51:14 -0700 (PDT)

Full_Name: Ross Wetmore
Version: cvs-Aug-23
Distribution: Don't know
Client: Both (or N/A)
OS: Red Hat Linux 7.0
Submission from: (NULL) (65.92.47.30)


Assertion appears to have failed because stack garbage was interpretable.

The error was unreproducible from the savegame.

Suggested fix attached

Cheers,
RossW
=====

--- .freeciv-Aug-23/common/unit.c   Tue Aug 14 08:06:03 2001
+++ freeciv/common/unit.c   Sat Aug 25 10:27:12 2001
@@ -1217,6 +1217,7 @@
   if (!reason) {
     reason = &dummy;
   }
+  *reason= MR_OTHER;

   /* 1) */
   if (activity != ACTIVITY_IDLE
===

Game saved as civgame1970.sav.gz
> civserver: aiunit.c:77: could_be_my_zoc: Assertion `is_ground_unit(myunit)'
failed.

real    7m40.851s
user    7m34.570s
sys 0m0.760s

(gdb) where
#0  0x2ab23131 in __kill () from /lib/libc.so.6
#1  0x2ab22ead in raise (sig=6) at ../sysdeps/posix/raise.c:27
#2  0x2ab24534 in abort () at ../sysdeps/generic/abort.c:88
#3  0x2ab1c8e1 in __assert_fail (assertion=0x80cf3f9 "is_ground_unit(myunit)",
    file=0x80cf3f0 "aiunit.c", line=77, function=0x80cf3e0 "could_be_my_zoc")
    at assert.c:60
#4  0x80ac81d in could_be_my_zoc (myunit=0x8264118, x0=64, y0=37)
    at aiunit.c:77
#5  0x80ac99b in could_unit_move_to_tile (punit=0x8264118, src_x=64, src_y=37,
    dest_x=65, dest_y=38) at aiunit.c:115
#6  0x80ae337 in ai_military_findvictim (pplayer=0x8126234, punit=0x8264118,
    dest_x=0x7ffff814, dest_y=0x7ffff818) at aiunit.c:655
#7  0x80b096d in ai_military_attack (pplayer=0x8126234, punit=0x8264118)
    at aiunit.c:1456
#8  0x80b123e in ai_manage_military (pplayer=0x8126234, punit=0x8264118)
    at aiunit.c:1734
#9  0x80b16d6 in ai_manage_units (pplayer=0x8126234) at aiunit.c:1892
#10 0x804c6bf in ai_start_turn () at srv_main.c:363
#11 0x804e87e in main_loop () at srv_main.c:1678
#12 0x804eef4 in srv_main () at srv_main.c:1968
#13 0x8049b65 in main (argc=3, argv=0x7ffff9a4) at civserver.c:147
#14 0x2ab12790 in __libc_start_main (main=0x804964c <main>, argc=3,
    ubp_av=0x7ffff9a4, init=0x8049060 <_init>, fini=0x80b275c <_fini>,
    rtld_fini=0x2aab835c <_dl_fini>, stack_end=0x7ffff99c)
    at ../sysdeps/generic/libc-start.c:111
(gdb) up
#3  0x2ab1c8e1 in __assert_fail (assertion=0x80cf3f9 "is_ground_unit(myunit)",
    file=0x80cf3f0 "aiunit.c", line=77, function=0x80cf3e0 "could_be_my_zoc")
    at assert.c:60
60  assert.c: No such file or directory.
(gdb) up
#4  0x80ac81d in could_be_my_zoc (myunit=0x8264118, x0=64, y0=37)
    at aiunit.c:77
77    assert(is_ground_unit(myunit));
(gdb) up
#5  0x80ac99b in could_unit_move_to_tile (punit=0x8264118, src_x=64, src_y=37,
    dest_x=65, dest_y=38) at aiunit.c:115
115     if (could_be_my_zoc(punit, src_x, src_y))
(gdb) print *punit
$1 = {type = 37, id = 2823, owner = 0, x = 64, y = 37, veteran = 1,
  homecity = 560, moves_left = 10, hp = 13, unhappiness = 0, upkeep = 1,
  upkeep_food = 0, upkeep_gold = 0, foul = 0, fuel = 0, bribe_cost = -1, ai = {
    control = 0, ai_role = AIUNIT_ATTACK, ferryboat = 0, passenger = 0,
    bodyguard = -1, charge = 0}, activity = ACTIVITY_IDLE, goto_dest_x = 3,
  goto_dest_y = 22, activity_count = 0, activity_target = 0,
  focus_status = FOCUS_AVAIL, ord_map = 0, ord_city = 0, moved = 0,
  paradropped = 0, connecting = 0, transported_by = -1, pgr = 0x0}
(gdb) print unit_types[37]
$1 = {name = "Destroyer", '\000' <repeats 22 times>,
  name_orig = "Destroyer", '\000' <repeats 22 times>,
  graphic_str = "u.destroyer", '\000' <repeats 20 times>,
  graphic_alt = "-", '\000' <repeats 30 times>, sprite = 0x0,
  move_type = SEA_MOVING, build_cost = 60, attack_strength = 4,
  defense_strength = 4, move_rate = 18, tech_requirement = 23,
  vision_range = 2, transport_capacity = 0, hp = 30, firepower = 1,
  obsoleted_by = -1, fuel = 0, flags = 0, roles = 0, happy_cost = 1,
  shield_cost = 1, food_cost = 0, gold_cost = 0, paratroopers_range = 0,
  paratroopers_mr_req = 0, paratroopers_mr_sub = 0,
  helptext = 0x8242c10 "TIP:  A very fast unit, which is very useful for
huntingdown enemy Transports."}





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