Subject: Re: The _weirdest_ segfault...
To: Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us>
From: Andreas Falck <faland-7@sm.luth.se>
List: port-alpha
Date: 05/18/2000 00:06:19
On Wed, 17 May 2000, Bill Sommerfeld wrote:

> > Yes, but it's not the writes or reads that segfaults, it's 
> > malloc() itself!
> 
> I'll go repeating what everyone else has been saying:
> 
> Faults do not necessarily occur at the same place in the code as the
> bug.  Sometimes a bug on one line of one module will not fault, but
> merely place an obstacle where another module will trip.  
> 
> > The shell works perfectly on FreeBSD/x86 where it was developed, the
> > problem is only on the Alpha!
> 
> Alphas are DIFFERENT.  
> 
> All the world is not an x86, and the x86 is far more forgiving of any
> number of sins of portability (e.g., alignment) than the alpha.  Data
> structures are different sizes because pointers are twice as large on
> alpha.

Of course. Though it sounded like Peter thought that it was a usual "write
beyond bounds" problem. I see what you mean.


> Does the code pass gcc -Wall -Werror cleanly?  Does it pass lint(1)?

"-Wall -Wpointer-arith -Wcast-align -Werror" passes.
I tried "lint" for the first time now, and it screams! No clean file in
the project, lots of warnings and errors. :)
e.g.
warning: conversion to 'unsigned long' due to prototype, arg #3
left operand of '->' must be pointer to struct/union

and stuff like that. I think I should take a closer look on lint!

> Do you cast between char * and other pointer types ever?
> 
Yes, many times. At least (void *) <-> (char *).


> Do you cast between pointer types and integer types?
>
Not that I know of, but maybe in someone elses code (3 ppl project).

It seems like there is much to do to make it run cleanly on the
Alpha. Maybe I make it a real project making it work after all.

Thank You all!

/Andreas