[comp.sys.amiga.tech] SAS/C 5.10 Compiler bug

mab@druwy.ATT.COM (Alan Bland) (09/24/90)

The code fragment listed below causes the SAS/C 5.10 compiler to crash:
a requester pops up from lc2 saying that it caught a guru.  Examining
the snapshot with tb shows an address error (000000003).  This example
is based on code that compiled correctly with 5.05.  Further experimentation
shows that if the #pragma for BltBitMap in <proto/graphics.h> is removed,
the code compiles without crashing.  I checked the 5.05 version of the
header file, and sure enough, the #pragma is commented out.  I don't
understand the details of the #pragma to know how to fix it, if that's
even possible.

If the old Lattice BBS were still around, I'd upload this there and consider
the bug to be officially reported.  Since I do my Amiga work at night, I
don't want to interrupt my day job to try to contact SAS by phone (and
probably wait on hold a while).  Since I know SAS reads this newsgroup,
I assume they will see this, and I won't bother to phone in.  SAS, please
bring back the BBS!

Name this code fragment "sasbug.c" and compile using "lc sasbug".  Don't
try to analyze the code itself, it's very far removed from the original code.


#include <exec/types.h>
#include <graphics/gfxmacros.h>
#include <proto/graphics.h>

extern struct RastPort *rp;

void junk(int x0, int y0)
{
	BltBitMap(rp->BitMap, x0, y0, 0, 0, 0, 0, 0, 0x0c0, 0xff, 0);
}

--
-- Alan Bland
-- att!druwy!mab == mab@druwy.ATT.COM
-- AT&T Bell Laboratories, Denver CO
-- (303)538-3510

walker@unx.sas.com (Doug Walker) (10/02/90)

In article <6185@drutx.ATT.COM> mab@druwy.ATT.COM writes:
>The code fragment listed below causes the SAS/C 5.10 compiler to crash:
>a requester pops up from lc2 saying that it caught a guru.  Examining
>the snapshot with tb shows an address error (000000003).  This example
>is based on code that compiled correctly with 5.05.  Further experimentation
>shows that if the #pragma for BltBitMap in <proto/graphics.h> is removed,
>the code compiles without crashing.  I checked the 5.05 version of the
>header file, and sure enough, the #pragma is commented out.  I don't
>understand the details of the #pragma to know how to fix it, if that's
>even possible.
>

This is a known bug in 5.10 - sometimes on a 68000, passing an odd integer
constant to a #pragma routine causes a guru.  It doesn't happen on a higher
processor (68010/68020/68030).  The workaround until a fix is available is
to assign the odd constant to a variable and pass the variable.

The reason the pragma was commented out in 5.05 is that the 5.05 compiler
didn't support #pragmas with more than 6 parameters; 5.10 does.  The
pragma itself is correct, it's the odd constant that is messing it up.


  *****
=*|_o_o|\\=====Doug Walker, Software Distiller====== BBS: (919)460-7430 =
 *|. o.| ||
  | o  |//     For all you do, this bug's for you!
  ====== 
usenet: ...mcnc!rti!sas!walker   plink: dwalker  bix: djwalker