[comp.sys.atari.st] Bug in MWC 3.0

Gribnif@UMass.BITNET (Dan Wilga) (08/01/88)

Greetings,


It would appear that I have truly found a real honest-to-goodness bug in
MWC 3.0.6. The following is a code segment that was compiled with the
-VPEEP option.


int in_wind[7], max_itm[7], w_num, rez;
 ...
slider()
{
  int b;

  ...
    if( (b = b * in_wind[w_num] / (max_itm[w_num]+in_wind[w_num]))
        < (4<<rez) ) b = 4<<rez;
  ...
}

A disassembly of the first part of this statement:

slider_+0x282   moveq.l   $0x4, d2         / correctly moves 4 into d2
slider_+0x284   move.w    rez_, d2         / then overwrites d2 with rez
slider_+0x28A   lsl.w     d2, d2           / result is rez<<rez, not 4<<rez

If the condition proves to be true, then "b" is assigned correctly; the
code generated uses d0 and d2 to do the shift.

This may or may not be related to the -VPEEP option, though this is the
first time I have had any trouble with it. I just thought you all might like
to be aware of this problem.


----------------------------------------------------------------------------
Dan Wilga                                      "My Other Program
Gribnif Software                                is Also a Porsche"
(413) 584-7887

Gribnif@UMASS.Bitnet
Gribnif%UMASS.Bitnet@Forsythe.Stanford.EDU