Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!husc6!cmcl2!rutgers!ames!pioneer!lamaster
From: lamaster@pioneer.arpa (Hugh LaMaster)
Newsgroups: comp.lang.c
Subject: Limit to array size under cc?
Message-ID: <3537@ames.arpa>
Date: Mon, 30-Nov-87 01:18:21 EST
Article-I.D.: ames.3537
Posted: Mon Nov 30 01:18:21 1987
Date-Received: Thu, 3-Dec-87 20:09:41 EST
Sender: usenet@ames.arpa
Reply-To: lamaster@ames.UUCP (Hugh LaMaster)
Organization: NASA Ames Research Center, Moffett Field, Calif.
Lines: 39


Is there a limit to the maximum size of an array using cc?  For
some reason, the maximum number that NR can be on a Sun (3.2) is
128766.  On a VAX (Ultrix 2.0) it is 130222.  Am I doing something
wrong or is it the compiler?
******************************************
Script started on Mon Nov 30 16:36:33 1987
csh[1] more junk2.c
#include 
#define NR 128767
[m
main()
{
    int nr ;
    int red[NR];
[m
    nr = NR;
[m
    for ( nr = 0; nr < NR; nr++ )
    {
            red[nr] = nr ;
[m
    }
    
    printf("\n red[%d] = %d\n", NR-1,red[NR-1] );
 }
csh[2] cc junk2.c
csh[3] a.out
Segmentation fault (core dumped)
script done on Mon Nov 30 16:40:12 1987



  Hugh LaMaster, m/s 233-9,  UUCP {topaz,lll-crg,ucbvax}!
  NASA Ames Research Center                ames!pioneer!lamaster
  Moffett Field, CA 94035    ARPA lamaster@ames-pioneer.arpa
  Phone:  (415)694-6117      ARPA lamaster@pioneer.arc.nasa.gov

(Disclaimer: "All opinions solely the author's responsibility")