1. weird bug?

Here's a really weird bug:

in my engine this causes it to crash:

 if ZBuffer[CamZB][pl+2]>z then
   TileBuffer[CamTile][pl+2]=3Drgb --pixel(col,{x,y})
   ZBuffer[CamZB][pl+2]=3Dz
  end if

but this works just fine:

  if ZBuffer[CamZB][pl+2]>z then
   TileBuffer[CamTile][pl+2]=3Drgb --pixel(col,{x,y})
   if pl<1 or pl>2+640*480 then=20

   end if
   ZBuffer[CamZB][pl+2]=3Dz
  end if

WHY IN EARTH????
This line,
   if pl<1 or pl>2+640*480 then  end if
shouldn't affect in any way to my program.
Have I found a bug in Euphoria or what?
Has anyone else noticed something similar to this?

--Talvitie

new topic     » topic index » view message » categorize

2. Re: weird bug?

On Sat, 9 Oct 1999, Talvitie wrote:

> Here's a really weird bug:
>
> in my engine this causes it to crash:
>

It would help if you could provide us with some details regarding the
nature of the 'crash'...  I realize that an empty if statement should have
no impact on your program but some debug output might help to track down
what is going on.

-- Brian

new topic     » goto parent     » topic index » view message » categorize

3. Re: weird bug?

>It would help if you could provide us with some details regarding the
>nature of the 'crash'...  I realize that an empty if statement should =
have
>no impact on your program but some debug output might help to track =
down
>what is going on.
>
>-- Brian

In Neil it just stops and shows an empty blank screen. I agree that an =
empty if statement shouldn't impact in any way. I think that this bug or =
whatever is in euphoria itself. Rob, any ideas?

new topic     » goto parent     » topic index » view message » categorize

4. Re: weird bug?

Talvitie writes:
> In Neil it just stops and shows an empty blank screen.
> I agree that an empty if statement shouldn't impact in any way.
> I think that this bug or whatever is in euphoria itself.
> Rob, any ideas?

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
     Rapid Deployment Software
     http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

5. Re: weird bug?

>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

new topic     » goto parent     » topic index » view message » categorize

6. Re: weird bug?

Talvitie writes:
> If you like Rob, I can send you the source so that you
> may check it.

OK, send it along.

Regards,
     Rob Craig
     Rapid Deployment Software
     http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view message » categorize

7. Re: weird bug?

>Talvitie writes:
>> If you like Rob, I can send you the source so that you
>> may check it.
>
>OK, send it along.
>
>Regards,
>     Rob Craig
>     Rapid Deployment Software
>     http://www.RapidEuphoria.com

Oops. I got the include file but lost the one that read it.
Now I have to
1. write a new file
2. check if the bug still exists in my current engine version
In both cases I hope you can wait a couple of days

sincerely,
--Talvitie

new topic     » goto parent     » topic index » view message » categorize

8. Re: weird bug?

Pete wrote:
>Talvitie-
>I look at safe.e and it appears that get_pixel was called with y=3D201 =
on a
>201x201 virtual screen (in LoadImage).  The only valid ranges for y =
should
>be from 0 to 200.


I fixed that one. thanks :)=20
The bug is gone(won't crash anymore) but now there's another: my engine =
speed is only half of the original if I uncomment the "unneccessary" =
line in it.
But hey, don't you guys worry about that now.=20
I'll write again if I can't remove it while being in optimization phase. =
And I got a lot to do before I get there.  ;)

--Talvitie

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu