amr@dukee.egr.duke.edu (Anthony M. Richardson) (04/11/89)
I just got access to the net and this is my first post so please excuse any breaches of protocol. I ran into a bug with 5.02 and I thought others might be interested. The following code does not execute correctly: temp = x1; x1 = x2; x2 = temp; temp = y1; y1 = y2; y2 = temp; This is supposed to swap x1 with x2 and y1 with y2. x1, x2, and y1 are all set to the correct values. The value of y2 however, is incorrect. It usually has the same value as x2. (In the orignal program from which I culled this fragment y2 was actually garbage.) I've been able to reproduce the error for int, float and double variable types. I was able to get around the bug by defining another temporary variable for use in swapping y1 and y2. (Perhaps the compiler does code optimization and this is being done incorrectly? I used only the default compiler options.) I reported this bug to Lattice about 1 1/2 months ago. They called me back about a week later and said they had been able to reproduce the bug and would start work on fixing it. I was told it looked like the bug only existed in 5.02. I haven't run into any other problems but this certainly lowered my confidence in the compiler. Tony Richardson amr@dukee.egr.duke.edu