[comp.sys.amiga.tech] Large arrays in Lattice V4.0

dooley@helios.toronto.edu (Kevin Dooley) (11/18/88)

I have been trying to run some of my larger number crunching monstrousities
on my Amiga (it's not much slower than a vax or a sun-4 because I'm not
competing with 15 people running emacs).  The only problem is that the
compiler balks at my huge arrays.  It gives me error number 82 for which
my handy dandy manual says:  
	"The size of an object exceeded the maximum legal size for objects
	in its storage class.  Alternatively, the last object declased caused
	the total size of declared objects for that storage class to exceed the
	maximum."
This is all very nice, but I want to run my program and I've got the
kilobytes I need.  How can I convince the compiler to do this?  I'll be
very disappointed if it can't be done.
		Kevin Dooley

-- 
 Kevin Dooley         UUCP - {uunet,pyramid}!utai!helios.physics!dooley
 Physics Dept.        BITNET - dooley@utorphys
 U. of Toronto        INTERNET - dooley@helios.physics.utoronto.ca

cmcmanis%pepper@Sun.COM (Chuck McManis) (11/23/88)

In article <652@helios.toronto.edu> dooley@helios.physics.utoronto.ca (Kevin Dooley) writes:
>I have been trying to run some of my larger number crunching monstrousities
>on my Amiga (it's not much slower than a vax or a sun-4 because I'm not
>competing with 15 people running emacs).  The only problem is that the
>compiler balks at my huge arrays.  It gives me error number 82 for which
>my handy dandy manual says:  

If you are using Lattice C :
Use the -b0 (thats a zero) switch when compiling your program. The default
in 4.0 (which was changed from 3.x) was to use 16 bit offsets for data
addressing and that won't work for arrays > 65533 bytes in size. Whereas
with -b0 you can address arrays up to two gigabytes. Be careful though
of preallocated arrays that are huge because it makes loading the code
at run time difficult if the memory space is fragmented. Often it is
better to use malloc() or calloc() to allocate those arrays. With MANX
I believe the latter is your only option at this time.



--Chuck McManis
uucp: {anywhere}!sun!cmcmanis   BIX: cmcmanis  ARPAnet: cmcmanis@sun.com
These opinions are my own and no one elses, but you knew that didn't you.

louie@trantor.umd.edu (Louis A. Mamakos) (11/23/88)

In article <78840@sun.uucp> cmcmanis@sun.UUCP (Chuck McManis) writes:
>If you are using Lattice C :
>Use the -b0 (thats a zero) switch when compiling your program. The default
>in 4.0 (which was changed from 3.x) was to use 16 bit offsets for data
>addressing and that won't work for arrays > 65533 bytes in size. Whereas
>with -b0 you can address arrays up to two gigabytes.


I used this technique when I ported TeX (after it was run through WEB-to-C)
to the the Amiga.  I malloc() all of the large arrays.  Beware, however;
Lattice C, version 4.01 generate broken code when the array subscript is
an unsigned short.  It treats it as a signed short and feels obligated to
sign extend it to 32 bits before adding it to the index register.

Result?  Very broken behavior when the array subscript is greater than
32767.  I'm somewhat annoyed in that I spent 30 minutes on the phone (at
my expense) explaining the problem to them, registering a problem report, and
then just waiting.  I was told that since the new 5.0 release was due out
"soon" (this was 2 and one half months ago) there would be no patch.

Does anyone know if this was fixed?  Are customers with outstanding problem
reports supposted to hear from Lattice about this?  Do I have to pay $75.00
to get the new version?

Gee, the flame content seems a bit high; I didn't mean it to be.  I really
like the Lattice compiler; I only wish it had unix-like command options.


Louis A. Mamakos  WA3YMH    Internet: louie@TRANTOR.UMD.EDU
University of Maryland, Computer Science Center - Systems Programming