Jump to content
Excelsior Forums
Sign in to follow this  
excbv

A Bug in XDS x-86 Native V. 2.51?

Recommended Posts

Hello,

I think I have discovered a curious bug in the V. 2.51 X-86 Native Oberon compiler, and I wonder whether an Excelsior person could comment it with hopefully a precise description so that one can avoid writing code where this bug can occur.

- The bug is illustrated with the files LifoInsertBug.ob2

  and LifoInsertBug.prj

- the program defines the types Lifo, T1, T2, and T3 where

  Lifo is the usual Lifo list, T1 and T3 are extensions of    the Lifo record, and T2 is an

  extension of T1

- when the procedure ShowBug is called, the code inside the

  procedure creates records pt2^ of type T2 and pt3^ of

  type T3, and then inserts pt3 into the pc component of

  pt2. Note that pt2 is a Lifo list element while pt2.pc is

  the head of a Lifo list

- The bug consists of the fact that pt3 gets assigned to

  the pt2.next component instead of the pt2.pc.next

  component.

- The simplest way to see the bug in action is to use the

  debugger, stop before pt2.pc.Insert is executed, examine

  the pt2 variable, then execute pt2.pc.Insert, and examine

  pt2 again.

Note: the program is a simplification of a real life program, and perhaps it could be made still simpler; however, I hope that it can be understood without too much difficulty.

Regards,

excbv

LifoInsertBug.prj

LifoInsertBug.ob2

Share this post


Link to post
Share on other sites

Hello,

The situation is somewhat changed. It turns out that this is an XDS debugger bug(?). If the debugger is not used, the program apparently works OK.

Regards,

excbv

Share this post


Link to post
Share on other sites

I could not reproduce the problem. In debugger (xd.exe) I see that pt2.pc.next is being changed, NOT pt2.next.

Also, adding the following assertions after the Insert method call triggers no run-time errors:

      pt2.pc.Insert(pt3); (* for some reason does not work; must be some
                             bug pt3 gets inserted into pt2.next instead
                             of pt2.pc.next *)
      ASSERT (pt2.pc.next = pt3, 60);
      ASSERT (pt2.next = NIL, 61);

(Assertion generation is ON by default, but still I added "-ASSERT+" to the project file, just in case. Still no errors.)

Conclusion: unable to reproduce the bug in compiler or debugger.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×