Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2002:
[Freeciv-Dev] Re: AI floating point exceptions
Home

[Freeciv-Dev] Re: AI floating point exceptions

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: AI floating point exceptions
From: Petr Baudis <pasky@xxxxxxxxxxx>
Date: Tue, 12 Mar 2002 17:50:20 +0100

Dear diary, on Tue, Mar 12, 2002 at 12:07:30AM CET, I got a letter,
where "Per I. Mathisen" <Per.Inge.Mathisen@xxxxxxxxxxx> told me, that...
> I keep getting some of these floating point exceptions in autogames:
> 
> Program received signal SIGFPE, Arithmetic exception.
> 0x080dc9d7 in assess_danger (pcity=0x8304850) at advmilitary.c:344
> 344               else ai_wants_role_unit(pplayer, pcity, F_PIKEMEN,
> (gdb) bt
> #0  0x080dc9d7 in assess_danger (pcity=0x8304850) at advmilitary.c:344
> #1  0x080df6a6 in military_advisor_choose_build (pplayer=0x816e470,
>     pcity=0x8304850, choice=0x8304efc) at advmilitary.c:954
> #2  0x080e1a7a in ai_manage_cities (pplayer=0x816e470) at aicity.c:546
> #3  0x080e4952 in ai_do_last_activities (pplayer=0x816e470) at
> aihand.c:505
> #4  0x08087dc2 in update_player_activities (pplayer=0x816e470) at
> plrhand.c:164
> #5  0x0804e82e in end_turn () at srv_main.c:469
> #6  0x08051775 in main_loop () at srv_main.c:1786
> #7  0x080520af in srv_main () at srv_main.c:2044
> #8  0x0804a34c in main (argc=3, argv=0xbffffab4) at civserver.c:153
> #9  0x400a06cf in __libc_start_main () from /lib/libc.so.6
> 
> Program received signal SIGFPE, Arithmetic exception.
> 0x080dcc91 in assess_danger (pcity=0x82fe7f0) at advmilitary.c:353
> 353             if (!igwall) danger2 += v * m / dist;
> (gdb) bt
> #0  0x080dcc91 in assess_danger (pcity=0x82fe7f0) at advmilitary.c:353
> #1  0x080df8f6 in military_advisor_choose_build (pplayer=0x816e710,
> pcity=0x82fe7f0,
>     choice=0x82fee9c) at advmilitary.c:954
> #2  0x080e1cca in ai_manage_cities (pplayer=0x816e710) at aicity.c:546
> #3  0x080e4ba2 in ai_do_last_activities (pplayer=0x816e710) at
> aihand.c:505
> #4  0x08087dc2 in update_player_activities (pplayer=0x816e710) at
> plrhand.c:164
> #5  0x0804e82e in end_turn () at srv_main.c:469
> #6  0x08051775 in main_loop () at srv_main.c:1786
> #7  0x080520af in srv_main () at srv_main.c:2044
> #8  0x0804a34c in main (argc=1, argv=0xbffffac4) at civserver.c:153
> #9  0x400a06cf in __libc_start_main () from /lib/libc.so.6
> 
> But I am unable to reproduce them in any consistent way, hence no
> savefile.
> 
> They were produced in autogames where I test a new version of the teams
> patch, which does not touch any AI-related code. The AIs were allied, so
> they would, naturally, be very confused. But still, the code shouldn't
> break like this.
> 
> Any takers?

Well, dist is taken from assess_distance(), which can return 0. And we don't
handle that case. A bug, yes :).

-- 

                                Petr "Pasky" Baudis

* elinks maintainer                * IPv6 guy (XS26 co-coordinator)
* IRCnet operator                  * FreeCiv AI hacker
.
"If you have acquired knowledge, what do you lack?
    If you lack knowledge, what have you acquired?"
Lev. R. 1:6
.
Public PGP key && geekcode && homepage: http://pasky.ji.cz/~pasky/


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