This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: GNU ObjC runtime bug.


Please revert this patch immediately from 3.0.

The table of methods which have been loaded is *global* for all classes.
The result of the patch is that once +load is called *once* in a class, it
is never called again in any other class!

In fact, gnustep-base doesn't work with that patch.

I know that before the thing wasn't satisfactory, but at least +load *was*
called.  It's better to restore the previous traditional situation on 3.0,
and we will attempt to figure out how to fix the details on the mainline.  
Trying to fix bugs so near the release is not a good idea.

Here is a testcase which worked before the patch, and fails after the
patch.  Please commit it to the testsuite as load2.m.

/* Contributed by Nicola Pero - Wed Jun  6 14:34:23 CEST 2001 */
#include <objc/objc.h>

/* Test that +load is automatically called before main is run; 
   on two different classes. */

static int static_variable1 = 0;
static int static_variable2 = 0;

@interface TestClass1
{
  Class isa;
}
+ (void) load;
@end

@implementation TestClass1
+ (void) load
{
  static_variable1 = 1;
}
@end

@interface TestClass2
{
  Class isa;
}
+ (void) load;
@end

@implementation TestClass2
+ (void) load
{
  static_variable2 = 1;
}
@end

int main (void)
{
  if (static_variable1 != 1  ||  static_variable2 != 1)
    {
      abort ();
    }
  
  return 0;
}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]