Xref: utzoo rec.games.hack:4913 comp.sources.games.bugs:1155 Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!rutgers!rochester!bolosky From: bolosky@cs.rochester.edu (Bill Bolosky) Newsgroups: rec.games.hack,comp.sources.games.bugs Subject: Re: Nethack crashes after picking character Keywords: GEC 63, Sys V, UX63 portable CC Message-ID: <1989Aug22.075948.22553@cs.rochester.edu> Date: 22 Aug 89 07:59:48 GMT References: <97@castle.ed.ac.uk> <1021@ks.UUCP> Reply-To: bolosky@cs.rochester.edu.UUCP (Bill Bolosky) Organization: U of Rochester, CS Dept, Rochester, NY Lines: 32 In article <1021@ks.UUCP> jriegel@cstemp2.almaden.ibm.com (Jeff Riegel) writes: >In article <97@castle.ed.ac.uk>, emct35@castle.ed.ac.uk (Jason Smith) writes: >> >> We can start the program up, it allows us to pick a character, then there is >> a dramatic pause, followed by a segmentation (memory) fault. >> > I'm having the same problem using an IBM RT running AIX 2.2.1. I'd appreciate finding out what this problem is. I compiled the program with SYS V defined. >Thanks in advance. > > >-Jeff >jriegel@ibm.com This problem has been around on RTs for several older versions of nethack, also. It's not operating system dependant, because it also happens under Mach. My (fairly strong) suspicion is that it's related to pointer rounding. The RT has (half and) fullword load and store operations that oly work when aligned on a (half or) fullword boundary. When you try to make an unaligned reference, it simply rounds the pointer down rather than generating an error, thus postponing the eventual crash to sometime more obscure and annoying. malloc and the compiler do their best to align everything on 32-bit boundaries, but it is quite possible to foil them. For example, if you do foo = malloc(100); *(int *)(foo+2) = x;, x will be written at *foo, not *(foo + 2). I have been meaning to look into the sources to find out who does this and fix it, but I'm far too busy (and lazy). If someone who's more familiar with the code knows where something like this might happen, and would let me know, I'd be happy to fix it. Bill