]> gcc.gnu.org Git - gcc.git/blobdiff - gcc/fold-const.c
Add TARGET_ADDR_SPACE_ZERO_ADDRESS_VALID
[gcc.git] / gcc / fold-const.c
index d8a45d998dc9318a5278be93d1eef453cc1be92c..8b437ab8f26b8f795d50dbaac8fd83cfaf5e1d4e 100644 (file)
@@ -1545,7 +1545,11 @@ const_unop (enum tree_code code, tree type, tree arg0)
       return fold_convert_const (code, type, arg0);
 
     case ADDR_SPACE_CONVERT_EXPR:
-      if (integer_zerop (arg0))
+      /* If the source address is 0, and the source address space
+        cannot have a valid object at 0, fold to dest type null.  */
+      if (integer_zerop (arg0)
+         && !(targetm.addr_space.zero_address_valid
+              (TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (arg0))))))
        return fold_convert_const (code, type, arg0);
       break;
 
This page took 0.043673 seconds and 5 git commands to generate.