[comp.unix.xenix] HELP!!!

root@ozdaltx.UUCP (root) (07/20/88)

I'm running SCO XENIX 2.2.1 and am trying to compile a
program that contains the following code:

main()
{
unsigned char p[720][72];
;
}
I keep getting the following error message

test.c
test.c(2) : error 126: auto allocation exceeds 32K

I've tried using -M[sml][012], -LARGE and up to -F 52000
in all sorts of combinations in the cc comand.  Can't find
anything in the manuals about the error.  

What do I need to do to get this to compile???
Thanks in advance....

-- 
 Scotty
 AIDS INFORMATION EXCHANGE BBS      (214) 247-2367/247-5609
                  "Education is the best weapon"
{ames,mit-eddie,rutgers,osu-cis,lll-winken,texsun,smu}!killer!ozdaltx!sysop 

davidsen@steinmetz.ge.com (William E. Davidsen Jr) (07/20/88)

The error message is clear, you have an auto variable which is too
large. Stick the word 'static' in front of it. You may have to use
large model.

-- 
	bill davidsen		(wedu@ge-crd.arpa)
  {uunet | philabs | seismo}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me

mike@ISIDAPS5.UUCP (Mike Maloney) (07/21/88)

In article <5029@ozdaltx.UUCP>, root@ozdaltx.UUCP (root) writes:
> I'm running SCO XENIX 2.2.1 and am trying to compile a
> program that contains the following code:
> 
> main()
> {
> unsigned char p[720][72];
> ;
> }
> I keep getting the following error message
> 
> test.c
> test.c(2) : error 126: auto allocation exceeds 32K

Move the declaration of 'p' to outside of the main.  It then becomes
external rather than automatic.  I believe that automatic storage comes 
from the stack frame when main is entered at run-time.  Hence on a 286
system, you're asking for a lot (even when you allocate 52K for the stack
with -F).

This shouldn't be a problem on 386 systems, because they use a variable
stack which can dynamically expand.  386 systems also aren't limited to
64K segments.

Good luck.
-- 

Mike Maloney				"The nice thing about standards
Integral Systems, Inc.			 is that there are so many to
Lanham Maryland				 choose from"  - Murphy

fyl@ssc.UUCP (Phil Hughes) (07/22/88)

In article <5029@ozdaltx.UUCP>, root@ozdaltx.UUCP (root) writes:
: I'm running SCO XENIX 2.2.1 and am trying to compile a
: program that contains the following code:
: main()
: {
: unsigned char p[720][72];
: ;
: }
: I keep getting the following error message
	 test.c
	 test.c(2) : error 126: auto allocation exceeds 32K

: What do I need to do to get this to compile???

Move the unsigned ... outside of main.  In other words, make it
a static instead of an automatic.

-- 
Phil    uunet!pilchuck!ssc!fyl 

root@ozdaltx.UUCP (root) (07/23/88)

Thanks to all who took time to respond both by e-mail and
here.  The suggestion of adding 'static' to the
declaration worked like a charm.

Seems like I tend to forget that many programs taken from
the net are written with somewhat an attitude of 'it works
for me', and I don't always pick up on possible problems.
Especially after the compiler had barfed 6 or 7 times and
the fustration starts mounting.

I have noticed that the SCO compiler seems to be more picky
about things, but at the same time forces adhearance to the
K & R rules... in most cases. ;-)

Again, thanks for the responces. I knew I could get an
answer here.

-- 
 Scotty
 AIDS INFORMATION EXCHANGE BBS      (214) 247-2367/247-5609
                  "Education is the best weapon"
{ames,mit-eddie,rutgers,osu-cis,lll-winken,texsun,smu}!killer!ozdaltx!sysop 

jack@turnkey.TCC.COM (Jack F. Vogel) (07/24/88)

In article <558@wrs.UUCP> owen@wrs.UUCP (Owen DeLong) writes:
>In article <5029@ozdaltx.UUCP> root@ozdaltx.UUCP (root) writes:
>>I'm running SCO XENIX 2.2.1 and am trying to compile a
>>program that contains the following code:
 
[...code detail deleted...]

>>I keep getting the following error message
>>test.c(2) : error 126: auto allocation exceeds 32K
                         ^^^^^^^^^^^^^^^
>Well, Scotty, you have a serious problem.  The error message is quite self
>explanatory.  720*72=51840.  51840>32768.  Thus, you are trying to define
>a static data structure larger than 32K.  This is not allowed in the 286....
   ^^^^^^
I would say you should look at these "self-explanatory" error messages more
carefully, Owen, considering your parsing of the message is exactly what
fixes the problem, as quite a few have already pointed out. It is also quite
silly to say you can't have arrays larger than 32K considering that 'huge'
arrays that exceed 64K are available.

Given the numerous responses of those who knew what they were talking about
I would say it would be time to open mouth and insert foot! (It might help
to cover what should obviously be a very red face too :-)



-- 
Jack F. Vogel
Turnkey Computer Consultants, Costa Mesa, CA
UUCP: ...{nosc|uunet}!turnkey!jack 
Internet: jack@turnkey.TCC.COM

owen@wrs.UUCP (Owen DeLong) (07/22/90)

In article <5029@ozdaltx.UUCP> root@ozdaltx.UUCP (root) writes:
>I'm running SCO XENIX 2.2.1 and am trying to compile a
>program that contains the following code:
>
>main()
>{
>unsigned char p[720][72];
>;
>}
>I keep getting the following error message
>
>test.c
>test.c(2) : error 126: auto allocation exceeds 32K
>
>I've tried using -M[sml][012], -LARGE and up to -F 52000

Well, Scotty, you have a serious problem.  The error message is quite self
explanatory.  720*72=51840.  51840>32768.  Thus, you are trying to define
a static data structure larger than 32K.  This is not allowed in the 286
version of SCO xenix due to the way the memory management stuff works.  You
have two choices.  Shrink the array or split it into more than one array
(which is usually the easiest solution), or Malloc it at run time and use
pointers to access it.  Bottom line is I found the error message in the
cc: A C compiler section of Programmers Guide.  The only problem was that
it didn't say anything more than the error message told me.  So I called
SCO, and they were kind enough to say "You fool, can't you read, your array
is more than 32KB.  Of course you can't compile it."  To which I replied
"Well, it would be nice if the manual gave some mention of this.  They said
that the manual said the same thing as the error message, and that they
thought it was quite clear.  So it goes.

Owen

P.S.  Solution number 3:  Buy a UNIX 4.x system on a 680x0. :-)