Re: weird bug?
- Posted by Talvitie <smtoa at SAUNALAHTI.FI> Oct 10, 1999
- 636 views
>Weird bugs like this are almost always due to >your program writing into areas of memory that >don't belong to it. Whether you add a dummy statement or >a whole extra include file is largely irrelevant. The point is >that you are changing the memory addresses and contents, >so the bug might just go away by luck. > >To debug this, you should copy euphoria\include\safe.e into >your working directory, then rename safe.e as machine.e. >safe.e provides safer versions of the routines in >machine.e such as poke() and mem_copy(). >Run the program again. It will say >"Using Debug Version of machine.e". The routines >in safe.e will often catch the bug. If they don't, it's still probably >a memory-related bug in your program (or in Neil) - >interpreter bugs are very rare compared to application bugs. >Of course, if you can clearly demonstrate that it's the >interpreter at fault, I'll be glad to look at it. > >Regards, > Rob Craig Bad news: I removed Neil from my engine so it won't use machine.e or = display graphics anymore. The bug stays! I have two almost identical = subroutines in my engine: Gouraud and Flat. Gouraud does it well, but = Flat crashes. Also if I remove this line: " ZBuffer[CamZB][pl+2]=3Dz = " from Flat's command lines it doesn't do anything weird. But, cause = Flat and Gouraud are identical in this point, it means that I'm not = writing to a bad place (ie. ZBuffer[-1][-5]) either. I'm not using any = machine language, so this just migth be a interpreter bug. From Flat: if ZBuffer[CamZB][pl+2]>z then TileBuffer[CamTile][pl+2]=3Drgb --!!!!!!!!!! HERE'S THE BUG !!!!!!!!!!!!! comment the next line and = the program will crash! if pl<1 or pl>2+640*480 then end if -- if you comment the next line then the program will run just = nice, and you don't need the=20 --previous one either to prevent crash ZBuffer[CamZB][pl+2]=3Dz end if From Gouraud: if ZBuffer[CamZB][pl+2]>z then TileBuffer[CamTile][pl+2]=3Dfloor(rgbIn*(x-x1)+rgb1) --This works just fine! ZBuffer[CamZB][pl+2]=3Dz end if If you like Rob, I can send you the source so that you may check it. --Talvitie