Path: utzoo!attcan!uunet!cs.utexas.edu!sdd.hp.com!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!sics.se!uplog.se!uplog.uplog.se!thomas From: thomas@uplog.se (Thomas Tornblom) Newsgroups: comp.sys.m68k Subject: Re: cast (char *) to (int *) ? Message-ID: Date: 8 Aug 90 12:53:59 GMT References: <1990Aug7.183302.26585@cbnewsl.att.com> Sender: thomas@uplog.se (Thomas Tornblom) Followup-To: comp.sys.m68k Organization: TeleLOGIC Uppsala AB Lines: 29 In-Reply-To: rl@cbnewsl.att.com's message of 7 Aug 90 18:33:02 GMT In article <1990Aug7.183302.26585@cbnewsl.att.com> rl@cbnewsl.att.com (roger.h.levy) writes: We have a substantial amount of C code originally targeted to a 68008 system and now being ported to a 68000 system. In the past, we have casted character pointers to integer pointers in some situations and then dereferenced the pointer. Although this works OK with a 68008, it will result in a bus error on our 68000 target if the address of the data is odd. Since we need to correct our code, I was wondering whether a tool exists that can identify instances of such statements. BTW, I checked my K&R and noted the warning about possible addressing errors as a result of this practice. We realize the error of our ways so no further scolding is necessary. Roger Levy ...!rl@groucho.ATT.COM Are you sure it worked on the 68008 and not on the 68000? As I recall both the 68008 and the 68000 will generate an address error when trying to access anything wider than a byte on an odd address. I checked the 1983 "16-bit microprocessors data manual" from Moto and it says that the 68000 and 68008 have equal programmer models. Thomas -- Real life: Thomas Tornblom Email: thomas@uplog.se Snail mail: TeleLOGIC Uppsala AB Phone: +46 18 189406 Box 1218 Fax: +46 18 132039 S - 751 42 Uppsala, Sweden