Removed -O2 optimization from bootstrap Makefile to avoid odd compilation problem.
Removed -O2 optimization from bootstrap Makefile to avoid odd compilation problem.

Building on Debian Etch, I began noticing crashes due to memory corruption.
Thanks to Valgrind, I traced the problem to this function. Invalid writes
were occurring when the method count was zero but methods were still being
copied. When I added print statements to the first while loop, the count
became correct (it should have been 8). Also dropping -O2 appears to fix
the problem.

Method *class_copyMethodList(Class cls, unsigned int *outCount)
Method_t *class_copyMethodList(Class cls, unsigned int *outCount)
{
    // first count the methods
    int count = 0;
    struct objc_method_list *mlist;
    void *iterator = 0;
    while (( mlist = class_nextMethodList( cls, &iterator ) ))
        count += mlist->method_count;
    // then copy the methods into the list
    Method *list = (Method *) malloc (count * sizeof(Method));
    Method_t *list = (Method_t *) malloc (count * sizeof(Method));
    int index = 0;
    iterator = 0;
    while (( mlist = class_nextMethodList( cls, &iterator ) )) {
        int i;
        for (i = 0; i < mlist->method_count; i++) {
            list[index++] = &(mlist->method_list[i]);
        }
    }
    *outCount = count;
    return list;
}

This looks like a compiler optimization problem to me and rather than debug
gcc on Debian, I've removed -O2 optimization from the bootstrap Makefile.

It seemed odd to me that this problem wasn't occurring for the final Nu
build products, and on investigation I've discovered (realized) that we're
not building them with -O2 either. Oops. I'll fix that in another revision
(for Darwin only) after I've tested it on OS X.

heiko-henrich/nutor,gcbeyond/nu,jqk6/nu,nulang/nu,jqk6/nu,hodgeswt/nu,spotify/nu,alloy/nu,nulang/nu,jqk6/nu,gcbeyond/nu,heiko-henrich/nutor,alloy/nu,hodgeswt/nu,gcbeyond/nu,spotify/nu,heiko-henrich/nutor,timburks/nu,spotify/nu,timburks/nu,heiko-henrich/nutor,timburks/nu,gcbeyond/nu,spotify/nu,hodgeswt/nu,hodgeswt/nu,nulang/nu,jqk6/nu