[PATCH] Avoid SRA-created debug binds with uninitialized RHSs

Martin Jambor mjambor@suse.cz
Wed Feb 27 15:08:00 GMT 2013


Hi,

looking at dumps of PR 56294 I have noticed that on one occasion, SRA
total scalarization mechanism replaced an uninitialized structure with
scalar replacements and these then happened to end up in DEBUG bind
statements describing another structure.  Such replacements then did
not end up in the IL anywhere else (and not at all in -g0).  SSA
renaming is clever enough to replace them with NULLs later on but if
the replacements are never initialized in the function, this can be
easily avoided.

Bootstrapped and tested on x86_64-linux without any issues.  So far I
do not know whether it is required to fix PR 56294 but the patch is
tiny and simply avoids unnecessary work so I'd like to ask for
approval to commit to trunk now.

Thanks,

Martin


2013-02-26  Martin Jambor  <mjambor@suse.cz>

	* tree-sra.c (load_assign_lhs_subreplacements): Do not put replacements
	with no initialization to the RHS of debug statements.

Index: src/gcc/tree-sra.c
===================================================================
--- src.orig/gcc/tree-sra.c
+++ src/gcc/tree-sra.c
@@ -2870,7 +2870,12 @@ load_assign_lhs_subreplacements (struct
 							    lacc->size);
 
 	      if (racc && racc->grp_to_be_replaced)
-		drhs = get_access_replacement (racc);
+		{
+		  if (racc->grp_write)
+		    drhs = get_access_replacement (racc);
+		  else
+		    drhs = NULL;
+		}
 	      else if (*refreshed == SRA_UDH_LEFT)
 		drhs = build_debug_ref_for_model (loc, lacc->base, lacc->offset,
 						  lacc);



More information about the Gcc-patches mailing list