[net.micro.6809] Microware C Compiler Bugs

ingoldsby@calgary.UUCP (Terry Ingoldsby) (06/18/86)

I've been meaning to do this for some time, but have never gotten around
to it.  I was wondering how many people have found bugs in the Microware
OS9 C compiler, specifically the CoCo implementation sold by RS.  I've
found at least one:

    The bug involves using arrays and the `&' and `|' operators.  For
    example

        unsigned array[10];
        unsigned var;

    Any use of statements like

        var & array[1]   actually compile as   var & array[0]

    This can be corrected by using

        array[1] & var

    but if you are trying to & two array values, the one on the right
    hand side of the & will be indexed at zero.

I wrote Radio Shack about it, and they said that this was indeed a bug,
and that they would fix it in the next version.  Unfortunately, they
said that they had no current plans to release another version anytime
soon.  Does anyone know if there is a fix for this?

On another, related note.  I am doing some number crunching using this
compiler, and frequently get the error #40, Floating point under/overflow
error.  This usually stems from multiplying two very small numbers together.
I can, of course, put tests on every multiplication but this is very
inefficient.  What I would like to do is catch the signal, get hold of
the over/underflowed value, fix it, and get the corrected value back
to the multiplication statement.  Is this asking too much?  Why don't
I have this problem on other compilers?

		Terry Ingoldsby

emjej@uokvax.UUCP (06/22/86)

/* Written 11:15 am  Jun 18, 1986 by ingoldsby@calgary.UUCP in net.micro.6809 */
>I've been meaning to do this for some time, but have never gotten around
>to it.  I was wondering how many people have found bugs in the Microware
>OS9 C compiler, specifically the CoCo implementation sold by RS.
/* End of text from net.micro.6809 */

So far, I've found a couple (both of which Kim Kempf at Microware has known
about for a long time, so they should be fixed):

1. continue statements in for loops with null continue parts bypass the
   loop test part

2. * and typedefs don't mix well--this one shows up in compiling XLisp 1.2
   or later, because Mr. Betz declared a pointer to jmp_buf.  This is
   one of those points at which the excuse for a language definition that
   predates the ANSI committee is very vague, so I don't blame the folks
   who wrote the compiler, but it's sufficiently inconvenient that I think
   all agree it should be changed.

						James Jones

neals@tekigm.UUCP (Neal Sedell) (06/23/86)

In article <204@vaxb.calgary.UUCP>, ingoldsby@calgary.UUCP (Terry Ingoldsby) writes:
> I've been meaning to do this for some time, but have never gotten around
> to it.  I was wondering how many people have found bugs in the Microware
> OS9 C compiler, specifically the CoCo implementation sold by RS.  I've
> found at least one:
> 
   Now that you mention it, I did run into a compiler bug with '&' too.
I wanted to mask all but the lower 8 bits of an int:

	#define byte_mask 0xFF
	.
	.
	.
	if ( integer_array[index] & byte_mask )
		{ don't bother putting code here :-}


   Looking at the asm output revealed that the wunnerful compiler performs
the '&' by loading the D Register with the expression and doing a CLR A,
ALWAYS setting the zero flag and thus the IF evaluates false.  Of course
the workaround is simply inserting a compare with zero in the if clause.
I sent the good people at uWARE mail on this about a year ago and the
resounding silence convinced me that they assume no responsibility for
the compiler R-S sells, as it would seem R-S does ;-)  Keep those
interesting snafus coming.

   Oh yes, I'm about to attempt a SASI driver.  I have a COCO host adapter 
prototyped, a Xebec controller and a SA606 8M disk all ready to go.  After
I get moved and a few other things out of the way and assuming I get it
done before I will lose net access in two months... :-(


			Neal Sedell

-- 
 {zehntel | uw-beaver | reed | hp-pcd | hplabs | decvax}!tektronix!tekigm!neals

ed@qtc.UUCP (06/26/86)

I guess one has to be able to figue out how to install the compiler
to be able to find bugs :-)  I have the standard RS disks (yes two of
them) and recall reading an article explaining how to configure a
disk with the compiler (that fits on one disk)   Can anyone shed
some light.  I haven't spent alot of time yet with the CoCo/Os9/C
but plan to in the future...

-ed

-- 
        +------------------------------------------------------------+
        |  Ed Lisle                             |   ogcvax!          |
        |  Quantitative Technology Corporation  |   verdix!  qtc!ed  |
        |  Beaverton, OR        (503) 626-3081  |  sequent!          |
        +------------------------------------------------------------+