[comp.sys.mac.programmer] SADE problems???

snow@dinl.uucp (john snow) (05/27/89)

I have found what seems to be a bug in SADE.  I have the following
structure declared:

struct driver
{
  Ptr prime;
  Ptr control;
  Ptr close;
  Ptr a5_value;
  short ref;
  unsigned char slot1;
  unsigned char slot2;
  unsigned char done:1;
  unsigned char init1:1;
  unsigned char init2:1;
  unsigned char init3:1;
  unsigned char unused:4;
   .....

At a point in the program where init1 is checked, SADE gives me
this for the structure values:

*Driver
RECORD
  prime: ^Byte($003E5DC6);
  control: ^Byte($003E5DCE);
  close: ^Byte($003E5DBE);
  a5_value: ^'';
  ref: -53;
  slot: 0;
  slot: 12;
  done: 0;
  initi1: 0;
  initi2: 0;
  initi3: 0;
  unused: 0;
  .....

And here is a memory dump of the structure:

dm Driver,$20
00CFF800: 00 3E 5D C6 00 3E 5D CE 00 3E 5D BE 00 3E 5D 94
00CFF810: FF CB 00 0C 70 00 00 00 29 9E 80 04 00 00 3B 00

As you can see, there IS an a5_value and init1 2 & 3 are set.  The
code thinks so too.  So what's the problem, and just how reliable
is the value information provided by SADE????  Also, as you can
see from the dump, the bits of the bit fields (done, init1,...)
are stored in reverse order of their declaration.  Is this normal
or something strange in MPW C v3??  Could this be why SADE doesn't
see those bits?

Here is another thing that is causing me a lot of problems with some
old code that ran fine when compiled with MPW C version 2 but not
with version 3.  The following statement worked fine with version 2:

if ((longvalue & 0x0f00000) != (((long) bytevalue) << 20)) ....

With version 3 the expansion and bit shift works correctly, but when
the != compare is made, a byte is pulled from bytevalue and compared
to longvalue.  Believe it or not, they are always not equal.  Does
this seem like normal operation???  I know V3 does a lot of type cast
checking, but this seems to take it a little too far.  This code has
a lot of this type of operation scattered around in macros, any
suggestions as to how to handle it with minimum code changes??

	John Snow

#include <discalmer.h>
| If Pascal is the language for children, and Ada is the language for |
| criminals, then C is the language for consenting adults.            |