brad@kontron.UUCP (Brad Yearwood) (01/09/87)
Perhaps I am doing something else wrong, but C code that is known to run on both 4.2BSD on a Vax and an old Unisoft V7 Unix on a 1Mb 68000, breaks badly on the Alcyon 4.14 compiler. I have tried some manipulations on large arrays of double floats, any but the most trivial of which _seem_ not to work, often crashing the system (a particular favorite is hanging somewhere in printf). Often, fracturing complex statements into several trivial statements makes things work. The standard C I/O library _seems_ also to have data-dependent problems where read() will occasionally throw a curve and announce a short or zero return value when reading a Neochrome file that is perfectly readable by Neochrome. Two different programs will fail given the same input file, one being a trivial hex dumper that does nothing involved or tricky. Does anyone have recommendations on trustworthy compilers (under the constraint that I need floats and doubles, and use large arrays), or experiences to suggest that I should examine my own code, machine, or environment more closely? What do people doing serious work for or on the ST use for tools? Brad Yearwood Kontron Electronics {voder, pyramid}!kontron!brad Mountain View, California
braner@batcomputer.tn.cornell.edu (braner) (01/09/87)
[] I had the same problem using Megamax C on the ST. It is really a simple problem, turns out: You're trying to put too much stuff (big arrays) in automatic variables (local to main()?), and you overflow the stack (which is where those are stored.) Solution: either increase the stack space alloted in the program startup (see your compiler's instructions), or put your arrays in global or static variables, or in malloc()ed space. - Moshe Braner