[Coco] Os9 C cross compiler. Progress!

Walter Zambotti zambotti at iinet.net.au
Fri Nov 22 01:11:18 EST 2019


After much debugging I found what was causing a problem in ansifront.

 

It turned out to be a logic assumption in coprep (c_prep19) that was passing
on its problems.

 

In the:

 

int space(int a, int b)

 

function.

 

There was this line of code:

 

strcpy(bptr + 1, cptr);

 

where bptr and cptr are pointers within the same string. Bptr points to
beginning of white space and cptr points to first non white character ther
after.

 

The line basically converts multiple spaces into one space.

 

However as the both pointers are in the same string this implies overlapping
copy areas.

 

So this will only work if the strcpy function is guaranteed to copy from
left to right.

 

While this may be the case for strcpy on OS9 it appears not to be the case
for Linux on Intel.

 

I stepped over that line of code many times before I detected the problem.

 

So several hours later 1 more bug down!

 

Both coprep & ansifront now appear to be working. I'll keep you all posted.

 

Walter



More information about the Coco mailing list