This is the mail archive of the gcc-patches@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]

libobjc: Fixed segmentation fault / wrong order when calling +load on categories loaded from multiple modules


This patch fixes a case where the code trying to execute +load would crash (or call 
+load in the wrong order) because a class that is treated as unresolved in the code 
was actually already resolved.

This patch includes a newly-built couple of testcases that test that +load is sent 
to classes and categories in precisely the required order when loading them from 
multiple modules (and, obviously, that it doesn't segfault).  In particular, on my 
machine the load-category-3 test segfaults without the patch, and is fixed by the 
patch.

Committed to trunk.

Thanks

In libobjc/:
2010-12-26  Nicola Pero  <nicola.pero@meta-innovation.com>

        * init.c (create_tree_of_subclasses_inherited_from): Use
        class_superclass_of_class instead of assuming a class is
        unresolved when it could be resolved.  Tidied up code.
        (__objc_tree_insert_class): Enhanced DEBUG_PRINTF.
        (objc_tree_insert_class): Tidied up loop; return immediately upon
        inserting a class.
        (__objc_exec_class): Do not set __objc_class_tree_list.

In gcc/testsuite/:
2010-12-26  Nicola Pero  <nicola.pero@meta-innovation.com>

        * objc.dg/special/special.exp: Added load-category-2 and
        load-category-3 tests.
        * objc.dg/special/load-category-2.h: New.
        * objc.dg/special/load-category-2.m: New.
        * objc.dg/special/load-category-2a.m: New.
        * objc.dg/special/load-category-3.h: New.
        * objc.dg/special/load-category-3.m: New.
        * objc.dg/special/load-category-3a.m: New.

Attachment: patch.txt
Description: Text document


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