Microport Unix -- Large Model Problems

Larry Campbell campbell at maynard.UUCP
Fri Oct 31 10:16:00 AEST 1986


In article <188 at vsedev.VSE.COM> ron at vsedev.VSE.COM (Ron Flax) writes:
>Has anyone  else  out  there  been  experiencing  problems  with porting
>programs to Microport Unix V/AT that fall into the large model category?
>It seems  that  most  everything  I  port  (try  to port?)   has pointer
>alignment problems,  as  indicated by  lint, or  just core  dumps with a
>segmentation violation at strange places in the code, like on a strlen()
>call?
>
>Sdb seems to indicate a  memory fault  as the  culprit and  I think that
>most of the problems are pointer related since an 'int' ain't
>necessarily an 'int'  (ie.   16 bits  in small  model, 32  bits in large
>model).  Does anyone have any  words of  wisdom as  to how  one might go
>about fixing pointer alignment problems without too much pain?

The simplest solution is to get your code to pass through lint without
complaints.  The most common problem I've found (especially from code
written on 68Ks and VAXen) is for people to not bother declaring pointer
valued objects:

	char *p;

	p = malloc(128);

oops, malloc is implicitly declared (int), not (char *), so you get
a bogus pointer because ints are 16 bits while pointers are 32 bits.
There should have been an "extern char *malloc();" in there.  Lint will
find these for you.
-- 
Larry Campbell       MCI: LCAMPBELL          The Boston Software Works, Inc.
UUCP: {alliant,wjh12}!maynard!campbell      120 Fulton Street, Boston MA 02109
ARPA: campbell%maynard.uucp at harvisr.harvard.edu     (617) 367-6846



More information about the Comp.unix.wizards mailing list