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]
Other format: [Raw text]

bug in objc runtime handling categories


Hi,

There's a bug in gcc v3.0.1's objective-c runtime's handling of
unclaimed categories (in libobjc/init.c, __objc_exec_class()). If the
class for an unclaimed category is found, the cell pointer is advanced
twice: once from the list_remove_head() and once in the loop itself,
thus skipping a category after every match. This patch fixes the
problem.

Note that most of the time this problem doesn't show up. Since the loop
is executed once for every module loaded, usually all categories are
eventually added.

Also, what is the right place to send bug reports/patches for the
objective-c runtime?

- Alexander Malmberg


--- init.c.orig Fri Dec 14 00:50:32 2001
+++ init.c      Fri Dec 14 01:18:39 2001
@@ -601,7 +601,7 @@
      categories to objects.  */
   for (cell = &unclaimed_categories;
        *cell;
-       ({ if (*cell) cell = &(*cell)->tail; }))
+       )
     {
       Category_t category = (*cell)->head;
       Class class = objc_lookup_class (category->class_name);
@@ -630,6 +630,8 @@
              only done for root classes. */
           __objc_register_instance_methods_to_class(class);
        }
+       else
+         cell = &(*cell)->tail;
     }
   
   if (unclaimed_proto_list && objc_lookup_class ("Protocol"))


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