# DP: Fix ICE in tree_to_shwi, Linaro issue #2575.

--- a/src/gcc/varasm.c
+++ b/src/gcc/varasm.c
@@ -6777,8 +6777,9 @@
 	 anchor range to reduce the amount of instructions require to refer
 	 to the entire declaration.  */
       if (decl && DECL_SIZE (decl)
-	 && tree_to_shwi (DECL_SIZE (decl))
-	    >= (targetm.max_anchor_offset * BITS_PER_UNIT))
+         && (!tree_fits_shwi_p (DECL_SIZE (decl))
+             || tree_to_shwi (DECL_SIZE (decl))
+                >= (targetm.max_anchor_offset * BITS_PER_UNIT)))
 	return false;
 
     }
