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]

[tree-ssa][objc] Fix regression strings regression


From objc-act.c:
      /* For the NeXT runtime, we can generate a literal reference
	 to the string class, don't need to run a constructor.  */

Since we can do that we need to actually make the constructor tree
actually use the fields since the middle end will crash without it.
This patch just adds the fields to the purpose of the lists.

Tested on both powerpc-apple-darwin with no regressions and on
i686-pc-linux-gnu with no regressions. OK?

Thanks,
Andrew Pinski

ChangeLog:

	* objc/objc-act.c (build_objc_string_object):
	Add the fields to the purpose of the list for
	the constructor.

Index: objc-act.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/objc/objc-act.c,v
retrieving revision 1.137.2.36
diff -u -p -r1.137.2.36 objc-act.c
--- objc-act.c	1 Apr 2004 17:21:36 -0000	1.137.2.36
+++ objc-act.c	12 Apr 2004 21:14:59 -0000
@@ -1381,6 +1381,7 @@ build_objc_string_object (tree string)
 {
   tree initlist, constructor, constant_string_class;
   int length;
+  tree fields;

string = fix_string_type (string);

@@ -1410,6 +1411,7 @@ build_objc_string_object (tree string)
 	}
       add_class_reference (constant_string_id);
     }
+  fields = TYPE_FIELDS (constant_string_type);

/* & ((NXConstantString) { NULL, string, length }) */

@@ -1425,18 +1427,23 @@ build_objc_string_object (tree string)
 	  return error_mark_node;
 	}
       initlist = build_tree_list
-	(NULL_TREE,
+	(fields,
 	 copy_node (build_unary_op (ADDR_EXPR, string_class_decl, 0)));
     }
   else
     {
-      initlist = build_tree_list (NULL_TREE, build_int_2 (0, 0));
+      initlist = build_tree_list (fields, build_int_2 (0, 0));
     }

+ fields = TREE_CHAIN (fields);
+
initlist
- = tree_cons (NULL_TREE, copy_node (build_unary_op (ADDR_EXPR, string, 1)),
+ = tree_cons (fields, copy_node (build_unary_op (ADDR_EXPR, string, 1)),
initlist);
- initlist = tree_cons (NULL_TREE, build_int_2 (length, 0), initlist);
+
+ fields = TREE_CHAIN (fields);
+
+ initlist = tree_cons (fields, build_int_2 (length, 0), initlist);
constructor = objc_build_constructor (constant_string_type,
nreverse (initlist));


Attachment: fixstring.txt
Description: Text document


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