[ObjC PATCH: RFA] Re: bug in objc runtime handling categories

Nicola Pero nicola@brainstorm.co.uk
Fri Dec 14 08:17:00 GMT 2001


> 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, <...>

thanks Alexander - you're correct - brilliant !

to Stan/Ovidiu -

I produced a testcase for the problem to add to the gcc regression
testsuite (and to convince other people that Alexander's patch is correct
:-), which is in attach.  To see the problem in action, I compile two
separate modules, then link them together, then run the result _ to do
this in the gcc regression testsuite I had to write some little .exp code
- what I did is I created a objc.dg/special directory, and put the
testcase (composed of the three files) there, with a very simple
special.exp which runs the testcase there (all very similar to
gcc.dg/special).

Of course, the testcase fails before the patch, and passes after the
patch.

to Stan/Ovidiu - ok to commit the fix to libobjc in gcc 3.1 + to create
the new objc.dg/special testcase dir and put the testcases there ?

> --- 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"))
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: special.tgz
Type: application/x-gzip
Size: 1548 bytes
Desc: 
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20011214/a8ecd788/attachment.bin>


More information about the Gcc-bugs mailing list