NerdanelVampire: I thought it would make sense file a list of gcc warnings that look like they might be 64-bit related. I left out all that old stuff about values computed but not used etc. Squashing these warnings should do something to the extreme instability of everything. ToME crashes on character creation. Zothiqband crashes on character creation. Dungeon Rumble crashes when you pick up an object. ODE crashes when you pick up an object...

Remember: Pointers are 64 bits long in 64 bits.

cache.c: In function 'cache_loadsave_vault_type': 
cache.c:358: warning: pointer targets in passing argument 1 of 'do_byte' differ in signedness
cache.c: In function 'cache_loadsave_monster_ego':
cache.c:393: warning: pointer targets in passing argument 1 of 'do_byte' differ in signedness
cache.c:413: warning: pointer targets in passing argument 1 of 'do_byte' differ in signedness
cache.c: In function 'cache_loadsave_ego_item_type':
cache.c:428: warning: pointer targets in passing argument 1 of 'do_byte' differ in signedness
cache.c: In function 'cache_loadsave_wilderness_type_info':
cache.c:489: warning: pointer targets in passing argument 1 of 'do_byte' differ in signedness
cache.c: In function 'init_ra_info':
cache.c:648: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c:657: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c: In function 'init_f_info':
cache.c:802: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c:811: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c: In function 'init_wf_info':
cache.c:946: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c:955: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c: In function 'init_s_info':
cache.c:1063: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c:1072: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c: In function 'init_a_info':
cache.c:1217: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c:1226: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c: In function 'init_d_info':
cache.c:1497: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c:1506: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c: In function 'init_v_info':
cache.c:1625: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c:1634: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c: In function 'init_st_info':
cache.c:1756: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c:1765: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c: In function 'init_ba_info':
cache.c:1859: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c:1868: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c: In function 'init_re_info':
cache.c:2035: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c:2044: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c: In function 'init_e_info':
cache.c:2211: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c:2220: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c: In function 'init_r_info':
cache.c:2449: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c:2458: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c: In function 'init_ab_info':
cache.c:2609: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c:2618: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c: In function 'init_k_info':
cache.c:2764: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c:2773: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c: In function 'init_ow_info':
cache.c:2914: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c:2923: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c: In function 'init_descriptor_info':
cache.c:3168: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cache.c:3177: warning: pointer targets in passing argument 1 of 'do_s16b' differ in signedness
cave.c: In function 'lite_spot':
cave.c:2041: warning: pointer targets in passing argument 4 of 'map_info' differ in signedness
cmd5.c: In function 'do_cmd_copy_spell':
cmd5.c:593: warning: assignment from incompatible pointer type
flags.c: In function 'flag_set_full':
flags.c:354: warning: format '%d' expects type 'int', but argument 3 has type 'long int'
flags.c:354: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
loadsave.c: In function 'do_savefile_aux':
loadsave.c:2370: warning: pointer targets in passing argument 1 of 'do_byte' differ in signedness
main-x11.c: In function 'paste_x11_send':
main-x11.c:1997: warning: pointer targets in passing argument 7 of 'XChangeProperty' differ in signedness
main-x11.c: In function 'paste_x11_accept':
main-x11.c:2054: warning: pointer targets in passing argument 11 of 'XGetWindowProperty' differ in signedness
main-x11.c:2058: warning: pointer targets in passing argument 1 of 'type_string' differ in signedness
music.c: In function 'channel_finished':
music.c:28: warning: cast to pointer from integer of different size
util.c: In function 'inkey_aux':
util.c:1767: warning: passing argument 1 of 'keycode_is_directional' discards qualifiers from poin
ter target type
util.c: In function 'data_buffer_loadsave':
util.c:5068: warning: pointer targets in passing argument 1 of 'do_byte' differ in signedness
lua_bind.c: In function 'sdl_timer_callback':
lua_bind.c:586: warning: cast to pointer from integer of different size
w_mnster.c: In function 'toluaI_monster_can_pass_aux00':
w_mnster.c:3073: warning: passing argument 3 of 'tolua_getnumber' makes integer from pointer without a cast
w_mnster.c: In function 'toluaI_monster_monst_can_pass_square00':
w_mnster.c:3102: warning: passing argument 3 of 'tolua_getnumber' makes integer from pointer without a cast

NeilStevens: Thanks, but you should consider turning off the pointer signedness warning, since it has nothing to do with size.  -Wno-pointer-sign is what you want here. GNU, sigh...

NerdanelVampire: I hadn't given much attention to how ToME's numerous compile warnings used to be in 32 bits, so I was adding everything that looked vaguely appropriate. I think I was thinking that the signedness warning might have something to do with throwing out the high bits of unsigned something and treating the result as a signed number that was supposed to be positive, or something crazy like that. The warnings are what gets generated normally by using an unaltered makefile.std on my system.

For your convenience, a much shorter version without pointed signedness:

cmd5.c: In function 'do_cmd_copy_spell': 
cmd5.c:593: warning: assignment from incompatible pointer type
flags.c: In function 'flag_set_full':
flags.c:354: warning: format '%d' expects type 'int', but argument 3 has type 'long int'
flags.c:354: warning: format '%d' expects type 'int', but argument 4 has type 'long int'
music.c: In function 'channel_finished':
music.c:28: warning: cast to pointer from integer of different size
util.c: In function 'inkey_aux':
util.c:1767: warning: passing argument 1 of 'keycode_is_directional' discards qualifiers from poin
ter target type
w_mnster.c: In function 'toluaI_monster_can_pass_aux00':
w_mnster.c:3073: warning: passing argument 3 of 'tolua_getnumber' makes integer from pointer without a cast
w_mnster.c: In function 'toluaI_monster_monst_can_pass_square00':
w_mnster.c:3102: warning: passing argument 3 of 'tolua_getnumber' makes integer from pointer without a cast

NeilStevens: Thank you!

DarkGod: I fail to see how those lines could make everything crash .. mhh maybe the flags.c ones .. Could someone provide me with a ssh access to a 64bits machine so that I could check and see if the fixes, well .. fix it ?

NerdanelVampire: Can't you just post a diff here and let me check if it works? I'd have to apply for a hole in the local firewall in order to host a ssh server, and there's all sorts of hassle and unsecurity involved so that I'd rather not do it.

DarkGod: Actually the warns in flags.lua are in debug code, so it does not matter.. The other warns are also in non-important code. Could you gdb it and give me a stacktrace ? (and the emergency lua stacktrace T-Engine does, if any)

NerdanelVampire: This is what happens in an ODE-like module when you try to pick up an item:

error: attempt to index a nil value 
stack traceback:
   1:  function <855:file `/engine/objects.lua'> at line 869
error: attempt to index a nil value
stack traceback:
   1:  function <855:file `/engine/objects.lua'> at line 869
error: attempt to index local `obj' (a nil value)
stack traceback:
   1:  function <1058:file `/engine/objects.lua'> at line 1062
./tome3: software bug 17 16 (signal SIGSEGV)

And this is the stack trace. The problem indeed appears to be in flags.c, or that's where the crash occurs anyway. That pointer probably should point to something...

#0  flag_exists (t=0x48, key=308) at flags.c:581 
#1  0x000000000045707a in inven_carry_okay (o_ptr=0x0) at object2.c:1613
#2  0x0000000000455260 in object_pickup (this_o_idx=-1) at object1.c:1762
#3  0x00000000004557ff in py_pickup_floor (pickup=1) at object1.c:1970
#4  0x00000000004163d2 in carry (pickup=72) at cmd1.c:112
#5  0x0000000000418853 in do_cmd_stay (pickup=1) at cmd2.c:1992
#6  0x0000000000420fb8 in process_command () at dungeon.c:1546
#7  0x0000000000421a9e in process_player () at dungeon.c:2214
#8  0x0000000000422dee in main_loop () at dungeon.c:2422
#9  0x0000000000424fba in play_game (new_game=1 '\001') at dungeon.c:2722
#10 0x0000000000449f34 in main (argc=1, argv=0x7fff964ce608) at main.c:853

gdb reports this after the crash: Program exited with code 0377.

ODE-like modules also have a weird bug so that your hitpoint total fluctuates with every step between the normal amount and a number which appears to be over four billion, but which I think is actually far excess of it and too big to fit the screen. This doesn't happen at first, but after you restart the game from an old savefile. Bone has a similar bug, but the hitpoints get permanently stuck in the sky.

ToME and Zothiqband and Dragonball T crash silently right after character creation. No stack trace, no anything. All I can get from it that it's a segmentation fault.

AnonymousHero: The hitpoint thing... that's probably because of sign extension and the issues with differing signedness which gcc warns about.

BugReport800 (last edited 2007-03-23 06:49:28 by AnonymousHero)