[net.micro.amiga] Lattice C Problem

ken@ukma.UUCP (Ken Kubota) (12/31/85)

The Lattice C compiler (version 1.0) for the Amiga seems to have
trouble handling complicated statements.  As an extreme case, this
short rather questionable code causes a 'guru meditation' on a 512K
machine with 2 floppies under AmigaDOS 1.1.

main(){
int a,b,c,d,e,f,g,h,i,j;
if(a<0)if(b<0)if(c<0)if(d<0)if(e<0)if(f<0)if(g<0)if(h<0)if(i<0)if(j<0)a=0;
}

cbosgd!ukma!ken
ken@ukma.bitnet

hamilton@uiucuxc.CSO.UIUC.EDU (01/01/86)

>The Lattice C compiler (version 1.0) for the Amiga seems to have
>trouble handling complicated statements.

complicated?
try:
	#undef AMIGA
and watch the fireworks.

	wayne hamilton
	U of Il and US Army Corps of Engineers CERL
UUCP:	{ihnp4,pur-ee,convex}!uiucdcs!uiucuxc!hamilton
ARPA:	hamilton@uiucuxc.cso.uiuc.edu
CSNET:	hamilton%uiucuxc@uiuc.csnet
USMail:	Box 476, Urbana, IL 61801
Phone:	(217)333-8703

mykes@3comvax.UUCP (Mike Schwartz) (01/02/86)

In article <2440@ukma.UUCP> ken@ukma.UUCP (Ken Kubota) writes:
>The Lattice C compiler (version 1.0) for the Amiga seems to have
>trouble handling complicated statements.  As an extreme case, this
>short rather questionable code causes a 'guru meditation' on a 512K
>machine with 2 floppies under AmigaDOS 1.1.
>
>main(){
>int a,b,c,d,e,f,g,h,i,j;
>if(a<0)if(b<0)if(c<0)if(d<0)if(e<0)if(f<0)if(g<0)if(h<0)if(i<0)if(j<0)a=0;
>}
>
>cbosgd!ukma!ken
>ken@ukma.bitnet


Lattice apparently recursively parses your if statement until it overflows
the stack and dies.  I had a similar problem with:
	if (...) 
	else if (...)
	else if (...)
	...
	else
(a whole bunch of them).

mike schwartz

bruceb@amiga.UUCP (Bruce Barrett) (01/03/86)

In article <2440@ukma.UUCP> ken@ukma.UUCP (Ken Kubota) writes:
>The Lattice C compiler (version 1.0) for the Amiga seems to have
>trouble handling complicated statements.  

>if(a<0)if(b<0)if(c<0)if(d<0)if(e<0)if(f<0)if(g<0)if(h<0)if(i<0)if(j<0)a=0;

This type of "problem", I belive, is documented.  The "problem" is that
the default stack setting (4000bytes) is to small.  I set the stack to
8000 (1> STACK 8000<RETURN>) and it compiled just fine.  (I admit I tried
this with V1.1 compiler, not 1.0 but I fully expect this to work for
1.0 also.)
			Please keep those cards, letters, and bug reports
			comming!
			--BruceB

dlm@iheds.UUCP (Daryl Monge) (01/03/86)

> I set the stack to
> 8000 (1> STACK 8000<RETURN>) and it compiled just fine.

Does this mean that stack expansion for processes on the amiga is not
automatic as program execution progresses?  Can someone in the know
elaborate?


Daryl Monge
AT&T
Bell Labs, Naperville, Ill

...!ihnp4!ihelp!dlm

fnf@well.UUCP (Fred Fish) (01/05/86)

In article <461@amiga.amiga.UUCP> bruceb@hunter.UUCP (Bruce Barrett) writes:
>
>This type of "problem", I belive, is documented.  The "problem" is that
>the default stack setting (4000bytes) is to small.  I set the stack to

I have "stack 20000" in my Startup-Sequence file and have not found
too many things that won't compile or run.  Is anybody working on a compiler
that solves this stack problem transparently to the user.  This is one of
the few warts on an otherwise fine machine.  I have a couple ideas how it
could be done, but not real efficiently.  Even having a child process
allocate it's own stack at startup would be preferable.  One basic problem
the the current situation is that the parent process must know how much
stack all the the children it intends to run are going to need.


-- 

===============================================================================
Fred Fish  (415) 644-1230 ext 242  ucbvax!unisoft!fnf  well!fnf
===============================================================================