Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!columbia!rutgers!husc6!wjh12!maynard!campbell From: campbell@maynard.UUCP (Larry Campbell) Newsgroups: net.unix-wizards Subject: Re: Microport Unix -- Large Model Problems Message-ID: <401@maynard.UUCP> Date: Thu, 30-Oct-86 19:16:00 EST Article-I.D.: maynard.401 Posted: Thu Oct 30 19:16:00 1986 Date-Received: Fri, 31-Oct-86 03:25:48 EST References: <188@vsedev.VSE.COM> Reply-To: campbell@maynard.UUCP (Larry Campbell) Distribution: net Organization: The Boston Software Works Inc., Maynard, MA Lines: 31 Keywords: Microport, Unix, Memory, Segmentation, lint Summary: lint your code first In article <188@vsedev.VSE.COM> ron@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@harvisr.harvard.edu (617) 367-6846