[comp.os.minix] TAR, codegen bomb, etc.

75008378%VAX2.NIHED.HEA.IRL@cunyvm.cuny.edu (08/08/88)

Hello MINIXers,

(Firstly  - Can anyone hear me: I'm doing this through the EARN gatewayed
version of comp.os.minix (and no, I can't get there thru
EUNET - its a long story, so don't ask) and the last time I
tried this it seemed to go down a black hole - at least I didn't see
any replies, BUT I think I've got it right this time ...
so won't somebody please talk to me?)

Anyway, has anyone else been having fun getting PD-TAR going on
MINIX (V1.2)???  I had one small and one big problem (this is
all based on the original John Gilmore PD-TAR postings PLUS the MINIX fixes
posted by Richard Todd, (except I took ast's version of the fix to exit() -
but I don't think that matters here)):

1) Try compiling this under V1.2 cc (its a nonsense, but legal
source):

        int xxx()
        {
        long    sum;
        char    *p;
        sum += 0xFF & *p++;
        }

Unless MINIX just doesn't like me, you'll find that cg bombs out -
but at least it tells you so!  This construct arises in PD-TAR
in the file list.c.  (This may or may not be the same codegen bomb out
that Marty Leisner reported recently...). I just changed the
offending line to:

        sum = (sum + (0xFF & *p++));

This seems to work, so I didn't pursue it any further.

2) Now the nasty one: V1.2 cc doesn't seem to like static
variables declared anywhere within a function *except* at the
top of the function block - i.e. it doesn't like static
variables declared within arbitrary blocks.  This arises in
PD-TAR in the files create.c and extract.c (in both cases the
variable is called warned_once).  Actually, I not sure if it's
static variables or just any variables in a nested block - again
I didn't pursue it.  My fix was to shift the relevant
declarations out one block (to the function block proper) which
seemed to sort things out OK.  The thing that makes this one so
nasty is that cc doesn't tell you its in trouble, it just
generates bad code: asld eventually can't cope, but the file in
which it flags the problem is never (?) the one with the bad
code.  So you first have to find the code that is actually bad,
then find the C construct causing the problem etc. etc.  Great
fun.

Maybe this has all been broadcast before, but I
hope it saves *somebody* some effort.  Anybody know if these
things will be fixed in V1.3? (I havn't noticed a new cc, or
pieces thereof, in the postings, but maybe I missed something?)?
Incidently, PD-TAR *is* very good once its running: I've finally
got a clean backup of my MINIX partition (using bundle also).

Barry McMullin, NIHED, Dublin, IRELAND.
EARN/BITNET/EUNET(?):  <MCMULLINB@VAX2.NIHED.IE>