Path: utzoo!mnetor!uunet!husc6!bloom-beacon!tut.cis.ohio-state.edu!mailrus!nrl-cmf!ames!pasteur!ucbvax!DREA-XX.ARPA!DERMOTT From: DERMOTT@DREA-XX.ARPA (Dave Dermott) Newsgroups: comp.sys.atari.st Subject: Megamax c Bug Message-ID: <12385910436.15.DERMOTT@DREA-XX.ARPA> Date: 28 Mar 88 11:58:05 GMT Sender: usenet@ucbvax.BERKELEY.EDU Organization: The Internet Lines: 35 Re: Bug in Megamax c ver 1.1 The following C source produces incorrect code: /******************************/ main() { test((char)0); /* bug here */ test((char)1); /* this is OK */ } /********* produced code *************/ main:/* global */ LINK A6,L$0 CLR -(A7) JSR test(PC) test((char)0); MOVE.B #1,D0 missing stack add EXT D0 MOVE D0,-(A7) JSR test(PC) test((char)1); ADDQ.L #2,A7 OK L1: UNLK A6 RTS /**********************************/ The stack pointer is not restored after the first call to test(). This will cause unpredictable results later. The C source is not normal - it was produced by a PASCAL to C translation program in the TeX-to-C package.It took a lot of debugging to find this error. There are 10 C files of 50Kbytes each and the executable is about 250K. I think the cast to char is unnessary in most cases. Is this fixed in the new Megamax (Laser c)? I think I'm going to have to get a better compiler to get TeX-C working. David Dermott DERMOTT@DREA-XX.ARPA DARTMOUTH N.S. Canada. -------