diff mbox

PR other/51174: handle architectures with no DECL_COMDAT_GROUP

Message ID 4EC6CCF4.9050405@redhat.com
State New
Headers show

Commit Message

Aldy Hernandez Nov. 18, 2011, 9:24 p.m. UTC
Hi Richard.

David reports that on AIX, you can have DECL_COMDAT defined, but no 
DEC_COMDAT_GROUP.  Consequently tm_mangle() gets called incorrectly with 
a null.  I suggested making tm_mangle() handle nulls, but David 
preferred handling it in the caller.

I tested this patch on x86-64 Linux, and David tells me this fixes the 
problem on his AIX end.

Thanks to David for finding and fixing this problem.

OK?
* trans-mem.c (ipa_tm_create_version_alias): Handle unsupported
	HAVE_COMDAT_GROUP.
	(ipa_tm_create_version): Same.

Comments

Richard Henderson Nov. 22, 2011, 12:55 a.m. UTC | #1
On 11/18/2011 01:24 PM, Aldy Hernandez wrote:
> -  if (DECL_COMDAT (new_decl))
> +  if (DECL_COMDAT (new_decl) && HAVE_COMDAT_GROUP)
>      DECL_COMDAT_GROUP (new_decl) = tm_mangle (DECL_COMDAT_GROUP (old_decl));
> +  else
> +    DECL_COMDAT_GROUP (new_decl) = DECL_COMDAT_GROUP (old_decl);

This looks weird -- you're seting D_C_G after H_C_G is false?

We've already done copy_decl anyway -- you should be able to drop the else.


r~
diff mbox

Patch

Index: trans-mem.c
===================================================================
--- trans-mem.c	(revision 181488)
+++ trans-mem.c	(working copy)
@@ -4198,8 +4198,10 @@  ipa_tm_create_version_alias (struct cgra
   TREE_SYMBOL_REFERENCED (tm_name) = 1;
 
   /* Perform the same remapping to the comdat group.  */
-  if (DECL_COMDAT (new_decl))
+  if (DECL_COMDAT (new_decl) && HAVE_COMDAT_GROUP)
     DECL_COMDAT_GROUP (new_decl) = tm_mangle (DECL_COMDAT_GROUP (old_decl));
+  else
+    DECL_COMDAT_GROUP (new_decl) = DECL_COMDAT_GROUP (old_decl);
 
   new_node = cgraph_same_body_alias (NULL, new_decl, info->new_decl);
   new_node->tm_clone = true;
@@ -4233,8 +4235,10 @@  ipa_tm_create_version (struct cgraph_nod
   TREE_SYMBOL_REFERENCED (tm_name) = 1;
 
   /* Perform the same remapping to the comdat group.  */
-  if (DECL_COMDAT (new_decl))
+  if (DECL_COMDAT (new_decl) && HAVE_COMDAT_GROUP)
     DECL_COMDAT_GROUP (new_decl) = tm_mangle (DECL_COMDAT_GROUP (old_decl));
+  else
+    DECL_COMDAT_GROUP (new_decl) = DECL_COMDAT_GROUP (old_decl);
 
   new_node = cgraph_copy_node_for_versioning (old_node, new_decl, NULL, NULL);
   new_node->lowered = true;