Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!world!siegel From: siegel@world.std.com (Rich Siegel) Newsgroups: comp.sys.mac.programmer Subject: Re: Think Pascal 3.0.2 generates incorrect code? Keywords: Think Pascal 3.0.2 Message-ID: <1991Jun19.021037.16294@world.std.com> Date: 19 Jun 91 02:10:37 GMT References: <3264@krafla.rhi.hi.is> Organization: Symantec Language Products Group Lines: 21 In article <3264@krafla.rhi.hi.is> sigurasg@rhi.hi.is (Sigurdur Asgeirsson) writes: > >result^^[len1 + len2] := chr(0); >{this compiles to an ADD.W D0,D7 or some such, and then CLR.B (A0, D0.L)} >{instead of CLR.B (A0, D0.W), and some garbage in the high byte of D0, } >{sending the zero byte to outer space (or inner space) corrupting the } >{heap, crashing the mac, evoking a big laugh from my friend (who still } >{doesn't believe that it's a compiler error).} This is indeed a bug. The workaround is to declare the upper array bound as 32768, to force a sign extension of the index. This will be fixed in the next release of THINK Pascal. R. -- ----------------------------------------------------------------------- Rich Siegel Internet: siegel@world.std.com Software Engineer Applelink: SIEGEL Symantec Languages Group