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]

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



> 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"))
> 

Attachment: special.tgz
Description: GNU Zip compressed data


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