public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Don't build the decl for the constant pool twice
@ 2008-10-14 19:00 Andrew Haley
  2008-10-24 14:57 ` Andrew Haley
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Haley @ 2008-10-14 19:00 UTC (permalink / raw)
  To: gcc-patches, Java Patch List

We were building the decl for the cpool twice, which caused IPA failures.
Fixed thusly.

Andrew.


2008-10-14  Andrew Haley  <aph@redhat.com>

	* constants.c (build_constant_data_ref): Make sure we only build
	one copy of the decl for the constant pool.
Index: constants.c
===================================================================
--- constants.c	(revision 140904)
+++ constants.c	(working copy)
@@ -448,21 +448,25 @@
     }
   else
     {
-      tree type, decl;
       tree decl_name = mangled_classname ("_CD_", output_class);
+      tree decl = IDENTIFIER_GLOBAL_VALUE (decl_name);

-      /* Build a type with unspecified bounds.  The will make sure
-	 that targets do the right thing with whatever size we end
-	 up with at the end.  Using bounds that are too small risks
-	 assuming the data is in the small data section.  */
-      type = build_array_type (ptr_type_node, NULL_TREE);
-
-      /* We need to lay out the type ourselves, since build_array_type
-	 thinks the type is incomplete.  */
-      layout_type (type);
-
-      decl = build_decl (VAR_DECL, decl_name, type);
-      TREE_STATIC (decl) = 1;
+      if (! decl)
+	{
+	  /* Build a type with unspecified bounds.  The will make sure
+	     that targets do the right thing with whatever size we end
+	     up with at the end.  Using bounds that are too small risks
+	     assuming the data is in the small data section.  */
+	  tree type = build_array_type (ptr_type_node, NULL_TREE);
+
+	  /* We need to lay out the type ourselves, since build_array_type
+	     thinks the type is incomplete.  */
+	  layout_type (type);
+
+	  decl = build_decl (VAR_DECL, decl_name, type);
+	  TREE_STATIC (decl) = 1;
+	  IDENTIFIER_GLOBAL_VALUE (decl_name) = decl;
+	}

       return decl;
     }

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Don't build the decl for the constant pool twice
  2008-10-14 19:00 Don't build the decl for the constant pool twice Andrew Haley
@ 2008-10-24 14:57 ` Andrew Haley
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Haley @ 2008-10-24 14:57 UTC (permalink / raw)
  To: gcc-patches, Java Patch List

Andrew Haley wrote:
> We were building the decl for the cpool twice, which caused IPA failures.
> Fixed thusly.
> 
> Andrew.
> 
> 
> 2008-10-14  Andrew Haley  <aph@redhat.com>
> 
> 	* constants.c (build_constant_data_ref): Make sure we only build
> 	one copy of the decl for the constant pool.

Also applied to the gcc-4.3 branch.

Andrew.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-10-24 14:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-14 19:00 Don't build the decl for the constant pool twice Andrew Haley
2008-10-24 14:57 ` Andrew Haley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).