[comp.sys.m6809] Compiler bugs? Help!

johnd@tsdiag.UUCP (09/14/88)

 * I AM POSTING THIS FOR A FRIEND,PLEASE RESPOND TO HIM,TNX johnd *

I am using Microware's C compiler on my Tandy Color Computer 3 (OS-9 Level
II). I recently learned from Mike Knudsen (knudsen@ihwpt) that there are some
bugs he is aware of in this compiler.

One concerns using GOTOs under all the following conditions:
   1.  The goto jumped out of { }, maybe two levels
   2.  It jumped backwards.
   3.  It jumped to a label which was the first executable statement in 
       the function.

Another bug is where the C compiler doesn't like to refer to literal memory 
addresses.  Mike's example, if you want to read memory location FF90 you can
legally say:

       x = *((char *) 0xFF90);

 But c.asm apparently "corrects" the assembler the compiler puts out.  However, writing it this way works:

       char *p;
       p = (char *) 0xFF90;
       x = *p;

 Still another bug is beware of IF tests like:

       if ( var & mask )     instead write:     if ( ( var & mask) !=0 ) )

 because the first version sometimes always goes FALSE.

 Finally a major compiler bug is when you do:

        if (expr)...       or      if (!expr) ... 
where (expr) uses && with a constant mask that has a zero hi or low byte (like 0xFF or 0x3700).  Instead they should
be written as:
  
       if (expr !=0)       or      if (expr == 0).

Mike also mentioned possible problems with ? : expressions.  He said they
usually work right, but sometimes....


And now my big questions:  Does anyone have patches to the compiler for these
bugs?  Is anyone aware of any other bugs in this compiler?  Do you have
patches or ways to program around those bugs?  

Since I don't have direct access to this newsgroup, please e-mail me any
answers.  If someone could e-mail the patches which I could make with either
DEBUG or MODPATCH, I would appreciate it.  I also have the IPATCH utility but
since I not certain how to handle binary files via the net, please don't send
them right now.

Mike mentioned that the Level 2 Developer's Kit includes a newer assembler and
new linker.  The linker is "especially less buggy works with less memory.  No
other pieces have been updated."  Mike didn't elaborate on the bugs in the old
linker.  Till the budget includes getting the Developer's Kit, I'm stuck with
the original.  Can anyone detail the c.link bugs?  And (crossed fingers :-)  )
patches?
Thanks in advance for all the assistance.

Bob Billson, KC2WZ
UUCP: ucbvax!rutgers!petsd!tsdiag!ka2qhd!kc2wz or bellcore!hotps!ka2qhd!kc2wz

AGAIN PLS respond to bob directly, tnx.

     
-- 
US MAIL: J.Decatur / CONCURRENT COMPUTER CORP. (Former Perkin-Elmer DSG)
FAX: 201-870-4249    2 Crescent Pl. Oceanport NJ 07757   PH 201-870-4093 
UUCP: ucbvax!rutgers!petsd!tsdiag!johnd                     -- KA2QHD -- 
IP: 44.64.0.40 ka2qhd.ampr   PACKET RADIO: ka2qhd@nn2z  TWX:710-722-6502