[comp.sys.mac.programmer] MPW C 3.0 generates bad object file for global var > 131K

zben@umd5.umd.edu (Ben Cranston) (07/20/90)

MPW C 3.0 seems to generate bad code when any global variable exceeds a
length of 2**17 bytes (131072).  Is this a known problem, and especially,
has it been fixed in 3.1?

We suspect the code to build "partial" contents records (see MPW Ref Man p578)
is incorrect.  The following test program compiles and links correctly:

int a[180][180];
main ()
{
    int i,j;
    for (i=0; i<180; i++)
        for (j=0; j<180; j++)
            a[i][j] = 0;
}

The data size for this program was 129906.  The following test program compiles
but causes link to diagnose a bad relocatable binary (diagnostic below):

int a[200][200];
main ()
{
    int i,j;
    for (i=0; i<200; i++)
        for (j=0; j<200; j++)
            a[i][j] = 0;
}

The link diagnostics are:

### Link: Warning: Size of global data area exceeds permitted size: (Error 34)
# Size of global data area: 160306
### While reading file "xx.c.o"
### Link: Error: Bad repetition count for data module. (Error 42) a (3)
   <Bad object file or compiler error.>
### Link: Errors prevented normal completion.

It appears from running DumpObj on the .c.o file that bad "Contents" records
are being generated.  This looks like it is related to the splitting up of the
initial values into multiple "partial" "Contents" records.

We have a work-around of mallocing the space, but I'd like to get the problem
on the record if it is unknown, and be reassured that it has been fixed if it
is a known problem.

-- 

Ben Cranston <zben@umd2.umd.edu>
Warm and Fuzzy Networking Group, Egregious State University
My cat is named "Perpetually Hungry Autonomous Carbon Unit"; I call him "Sam".