[Bug libobjc/18764] segfault in libobjc when sending a message to a conflicting class

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Sep 16 04:24:00 GMT 2005


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-09-16 04:24 -------
I am going to implement the next runtime behavior.  The following code works and is just like the code 
in your testcase too but works with both runtimes:) :
#include <objc/objc-api.h>
#include <dlfcn.h>
#include <objc/Object.h>

#ifdef __NEXT_RUNTIME__
#define objc_get_class objc_getClass
#endif

int main()
{
  Class foo1;
  Class foo2;
  dlopen("./1.so", RTLD_NOW);
  foo1 = objc_get_class ("Foo");
  [foo1 class];
  dlopen("./2.so", RTLD_NOW);
  foo2 = objc_get_class ("Foo");
 //  [foo1 class];
  [foo2 class];
  return 0;
}
---
Also if [foo1 class] is uncommented, then it works also.  if you comment the first [foo1 class] and 
uncomment the second one, it aborts with:
objc: thread is already initializing this class!
Trace/BPT trap

If I do [foo2 class]; and then [foo1 class];, it works also.
I really think all should work just fine.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |pinskia at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18764



More information about the Gcc-bugs mailing list