[rec.games.hack] nethack won't run on MIPS running BSD4.3

fk@morgaine.rci.dk (Flemming Kraglund) (11/19/90)

nn86302@tut.fi (Niilo Neuvo) writes in rec.games.hack:

>I have been hackin this for the last twelve hours and I'm starting to 
>get a little bit tired.

>Okay I got v3b9, unpacked, edited, compiled, installed... But after 
>selecting my class I get a segmentation fault:
>Segmentation fault [dosdoor:567 ,0x448d74]
>        for( ; broom->hx >= 0; broom++) broom->fdoor++;

>(dbx) print broom->hx
>cannot read address 0x10059000 for process 15197
[cut]
>Any help greatly appreciated.

I had the same problem on a mips computer.

The problem is that your compiler defaults to unsigned chars and in the
file tradstdc.h at the end, signed gets defined to nothing, so

      for( ; broom->hx >= 0; broom++) broom->fdoor++;
             ^^^^^^^^^^^^^^
is allways true (and possible gets removed by the optimizer) and you get
a 'walking' pointer (broom).

the remedi (sp) is to add the following in the bottom of tradstdc.h

#undef	signed

#endif /* TRADSTDC.H */              last line in file, allready there

The absolute best thing to do if you know of a uniq symbol your preprossor
defines, is to use:
#ifdef mips    /* in my situation, substitute mips with your cpp's define */
# undef signed
#endif

ps:   maybe this shuld be in the readme/porting file?
-- 
 Flemming Kraglund   |         .--.--.       .----.   |  RC International (r&d)
                     |        (   '   )     (      )  |  Lautrupbjerg 1
 fk@morgaine.rci.dk  |         `.   .'       `'::`'   |  DK-2750 Ballerup
   (or see Path:)    |  make     `.'    not    ::     |  Denmark