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]

Fix Objective-C crash at -O3


Recent changes for deferred functions broke ObjC at -O3, but since
the ObjC testsuite doesn't do -O3 (the patch for this is next), it went
unnoticed until it caused the compiler to crash while compiling pieces
of Mac OS X.  Tested on i686-pc-linux-gnu and powerpc-apple-darwin.

Stan


2001-12-28  Stan Shebs  <shebs@apple.com>

        * objc/objc-act.c (build_module_descriptor): Make sure the init
        function is not deferred.
        (build_dispatch_table_initializer): Compute the method encoding if
        not already done.

Index: objc-act.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/objc/objc-act.c,v
retrieving revision 1.117
diff -c -3 -p -r1.117 objc-act.c
*** objc-act.c  2001/12/17 22:43:55     1.117
--- objc-act.c  2001/12/28 23:12:05
*************** build_module_descriptor ()
*** 1763,1768 ****
--- 1763,1771 ----
      init_function_decl = current_function_decl;
      TREE_PUBLIC (init_function_decl) = ! targetm.have_ctors_dtors;
      TREE_USED (init_function_decl) = 1;
+     /* Don't let this one be deferred.  */
+     DECL_INLINE (init_function_decl) = 0;
+     DECL_UNINLINABLE (init_function_decl) = 1;
      current_function_cannot_inline
        = "static constructors and destructors cannot be inlined";
  
*************** build_dispatch_table_initializer (type, 
*** 3855,3860 ****
--- 3858,3868 ----
        elemlist = tree_cons (NULL_TREE,
                            build_selector (METHOD_SEL_NAME (entries)),
                            NULL_TREE);
+ 
+       /* Generate the method encoding if we don't have one already.  */
+       if (! METHOD_ENCODING (entries))
+       METHOD_ENCODING (entries) =
+         encode_method_def (METHOD_DEFINITION (entries));
  
        elemlist = tree_cons (NULL_TREE,
                            add_objc_string (METHOD_ENCODING (entries),


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