[Coco] Microware C question/problem

Bob Devries bdevries at gil.com.au
Fri Dec 30 21:34:56 EST 2005

Well, I dunno, Robert.
I don't guess I'd expect good code from an obviously bad bit of C code. The 
template for strrchr() is:

Char *strrchr(char *s, int ch)

Now, given that the OS9 C compiler doesn't know about function templates, 
I'd expect *something* to go awry.

I'd agree though that the code seems to be very strange indeed.

Does the single-pass compiler executive produce the same code?
Could you post a complete code section, so I could test it here?
Regards, Bob Devries, Dalby, Queensland, Australia

Isaiah 50:4 The sovereign Lord has given me
the capacity to be his spokesman,
so that I know how to help the weary.

website: http://www.home.gil.com.au/~bdevasl
my blog: http://bdevries.invigorated.org/

----- Original Message ----- 
From: "Robert Gault" <robert.gault at worldnet.att.net>
To: "CoCoList for Color Computer Enthusiasts" <coco at maltedmedia.com>
Sent: Saturday, December 31, 2005 11:33 AM
Subject: [Coco] Microware C question/problem

>I am trying to test a library function in Microware C. A very strange bug 
>was found for which I can't find a source. Here is the library call that 
>causes the problem. Ignore whether the C syntax is correct but just look at 
>the resulting asm code.
> n = strrchr(*file, "/" || "\\");
> Partial output from c.pass2
>  lead _3,pcr
>  lbne _6
> _7
>  lead _4,pcr
> Clearly this is not legal code because of the lead. If the || "\\" is 
> removed from the source, the lead goes away.
> What is causing this bad asm code? It seems to be a c.pass2 problem but 
> I've compiled some very large C programs and never seen anything like this 
> before.
> -- 
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.371 / Virus Database: 267.14.9/217 - Release Date: 30/12/2005

More information about the Coco mailing list