[PATCH] Fix PR41159

Richard Guenther rguenther@suse.de
Wed Dec 21 09:31:00 GMT 2011


This fixes an ICE with -O0 at LTO link time.  The assertion that
the destination result is equal to the promote_decl_mode result
is only true for pseudos - but with -O0 we commit all autos to
stack variables, so SA.partition_to_pseudo[] can contain MEMs.

Fixed by adjusting the assertion and always using the
SA.partition_to_pseudo[] mode as destination mode.

Bootstrapped and tested on x86_64-unknown-linux-gnu and on alpha by Uros,
committed.

Richard.

2011-12-21  Richard Guenther  <rguenther@suse.de>

	PR lto/41159
	* tree-outof-ssa.c (insert_value_copy_on_edge): Use the
	mode of the pseudo as destination mode.  Only assert that
	is equal to the promoted mode of the decl if it is a REG.

Index: gcc/tree-outof-ssa.c
===================================================================
--- gcc/tree-outof-ssa.c	(revision 182525)
+++ gcc/tree-outof-ssa.c	(working copy)
@@ -237,9 +237,10 @@ insert_value_copy_on_edge (edge e, int d
 
   var = SSA_NAME_VAR (partition_to_var (SA.map, dest));
   src_mode = TYPE_MODE (TREE_TYPE (src));
-  dest_mode = promote_decl_mode (var, &unsignedp);
+  dest_mode = GET_MODE (SA.partition_to_pseudo[dest]);
   gcc_assert (src_mode == TYPE_MODE (TREE_TYPE (var)));
-  gcc_assert (dest_mode == GET_MODE (SA.partition_to_pseudo[dest]));
+  gcc_assert (!REG_P (SA.partition_to_pseudo[dest])
+	      || dest_mode == promote_decl_mode (var, &unsignedp));
 
   if (src_mode != dest_mode)
     {



More information about the Gcc-patches mailing list