[PATCH] Fix overly restrictive condition in get_symbol_constant_value

Richard Biener rguenther@suse.de
Wed Nov 26 11:05:00 GMT 2014


The following fixes an overly restrictive condition on the zeros we
produce when folding a read from a zero-initialized global.  Now it
matches what we allow elsewhere and what is useful.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2014-11-26  Richard Biener  <rguenther@suse.de>

	* gimple-fold.c (get_symbol_constant_value): Allow all
	GIMPLE register type zero-constants.

Index: gcc/gimple-fold.c
===================================================================
--- gcc/gimple-fold.c	(revision 218073)
+++ gcc/gimple-fold.c	(working copy)
@@ -254,8 +254,7 @@ get_symbol_constant_value (tree sym)
 	 have zero as the initializer if they may not be
 	 overridden at link or run time.  */
       if (!val
-          && (INTEGRAL_TYPE_P (TREE_TYPE (sym))
-	       || SCALAR_FLOAT_TYPE_P (TREE_TYPE (sym))))
+          && is_gimple_reg_type (TREE_TYPE (sym)))
 	return build_zero_cst (TREE_TYPE (sym));
     }
 



More information about the Gcc-patches mailing list