Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!mcvax!hafro!isgate!krafla!heimir From: heimir@rhi.hi.is (Heimir Thor Sverrisson) Newsgroups: comp.sys.ibm.pc Subject: Re: Bug in Turbo-C ver 2.0 Keywords: Huge model, incorrect code generation Message-ID: <1075@krafla.rhi.hi.is> Date: 11 Aug 89 10:15:08 GMT References: <420@vall.dsv.su.se> Organization: University of Iceland Lines: 38 mk@vall.dsv.su.se (Magnus Karlson) writes: >I were able to isolate the bug i hade located in TURBO-C ver 2.0 >when using HUGE memory model. Since several people asked for the >information i thought i also hsould post it here. I found this same bug several months ago. My experience was that it showed up _only_ when using the HUGE memory model _and_ subtracting and 'extern'ally defined array element. The following code would crash: extern int i_arr[]; main() { int i,j; j = i - i_arr[0]; } While addition was OK. Therefore my workaround was: extern int i_arr[]; main() { int i,j; j = i + (-i_arr[0]); } The code generated for the substraction actually destroys the stack, so you will certainly see it on your program :-) I sent a full documentation of the bug to the local Borland dealer, but that was just as sending it to the null-device :-( -- Heimir Sverrisson NeuroSoft Inc.