Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!utah-cs!sandra From: sandra@utah-cs.UUCP (Sandra J Loosemore) Newsgroups: comp.sys.atari.st Subject: Bug in Alcyon C v4.14 Message-ID: <4713@utah-cs.UUCP> Date: Sat, 4-Jul-87 10:15:20 EDT Article-I.D.: utah-cs.4713 Posted: Sat Jul 4 10:15:20 1987 Date-Received: Sat, 4-Jul-87 19:53:15 EDT Organization: University of Utah CS Dept Lines: 27 Keywords: bug pointer arithmetic I've just run across a rather annoying bug in Alcyon C v4.14 (the developer's kit C): it has a hard time with adding a word-sized integer constant to a pointer variable. My code originally looked something like STRUCTURE *this, *next; next = this + sizeof(STRUCTURE); /* sizeof(STRUCTURE) = 8192 */ and it was generating code like: add.l #$80000000,R0 No difference whether I used "sizeof" or hardwired in the constant directly, same bad results. I eventually got around the problem by doing next = this; next++; In another place, I was doing something similar: STRUCTURE *this, *next; int n; next = this + n*sizeof(STRUCTURE); and instead of generating a multiply it generated a CLR.L instruction! -Sandra Loosemore sandra@cs.utah.edu, sandra@utah-cs.uucpu