Path: utzoo!attcan!uunet!mailrus!cs.utexas.edu!wuarchive!udel!wack From: wack@udel.edu (Andrew Wack) Newsgroups: comp.sys.apple Subject: Re: ORCA/C problems Message-ID: <10463@nigel.udel.EDU> Date: 8 Feb 90 00:26:43 GMT References: <1990Feb7.034310.5315@ux1.cso.uiuc.edu> Sender: usenet@udel.EDU Reply-To: wack@udel.edu (Andrew Wack) Organization: University of Delaware Lines: 47 Speaking of ORCA/C bugs, I've got one....(actually 2). Try the following program: #pragma optimize 1 #include void main(void) { long int x; x = 1600; printf("%li \n", x); x -= 4096; printf("%li \n", x); } What you should get is 1600 and -2496, instead it generates 1600 and 2^17 - 4096 + 1600 (I forget what it is, but I know how the compiler is comming up with it). If you remove the optimize pragma it works fine. Also it doesn't help to type-cast the 4096 as (long) (and you shouldn't have to). I suspect that when the optimizer is doing its constant expression evaluation, it generates code to subtract 4096 as though it were an int, not a long, which would result in the funny answer. The reason I say this is two bugs is that I only discovered this one because the compiler has been giving me the "terminal compiler error" for a piece of code I've been working on and sending me back to the text edditor when I compile with no optimiation. If I turn on optimize 1, the terminal error goes away, but I get the above funny results. Actualy I just thought of a third minor bug in the assembly language displays...the dissasembler dissasembles a TCS as a TSC (or vice-versa, I can't remember right now). This creates a problem when doing debugging on the desktop at the assembly level, since their emulator follows this error! Makes it kind of tough to save the stack pointer. Does anybody know if these bugs (primarily the first two) are fixed in the beta compiler? I'm really getting tired of wasting time coding around these problems. (Although I must say I'm very impressed by the Desktop and ORCA/C in general for a version 1.0 product). -- -------------------------------------------------------------------------------- Andrew Wack Gravitation cannot be held responsible ARPA : wack@udel.edu for people falling in love -- Albert Einstein