OSDN Git Service

2005-12-28 Daniel Berlin <dberlin@dberlin.org>
[pf3gnuchains/gcc-fork.git] / gcc / varasm.c
index 3a2fe22..f39b07c 100644 (file)
@@ -3477,18 +3477,24 @@ initializer_constant_valid_p (tree value, tree endtype)
     case ADDR_EXPR:
     case FDESC_EXPR:
       value = staticp (TREE_OPERAND (value, 0));
-      /* "&(*a).f" is like unto pointer arithmetic.  If "a" turns out to
-        be a constant, this is old-skool offsetof-like nonsense.  */
-      if (value
-         && TREE_CODE (value) == INDIRECT_REF
-         && TREE_CONSTANT (TREE_OPERAND (value, 0)))
-       return null_pointer_node;
-      /* Taking the address of a nested function involves a trampoline.  */
-      if (value
-         && TREE_CODE (value) == FUNCTION_DECL
-         && ((decl_function_context (value) && !DECL_NO_STATIC_CHAIN (value))
-             || DECL_DLLIMPORT_P (value)))
-       return NULL_TREE;
+      if (value)
+       {
+         /* "&(*a).f" is like unto pointer arithmetic.  If "a" turns out to
+            be a constant, this is old-skool offsetof-like nonsense.  */
+         if (TREE_CODE (value) == INDIRECT_REF
+             && TREE_CONSTANT (TREE_OPERAND (value, 0)))
+           return null_pointer_node;
+         /* Taking the address of a nested function involves a trampoline.  */
+         if (TREE_CODE (value) == FUNCTION_DECL
+             && ((decl_function_context (value) 
+                  && !DECL_NO_STATIC_CHAIN (value))
+                 || DECL_DLLIMPORT_P (value)))
+           return NULL_TREE;
+         /* "&{...}" requires a temporary to hold the constructed
+            object.  */
+         if (TREE_CODE (value) == CONSTRUCTOR)
+           return NULL_TREE;
+       }
       return value;
 
     case VIEW_CONVERT_EXPR:
@@ -3883,7 +3889,7 @@ array_size_for_constructor (tree val)
   i = size_binop (MINUS_EXPR, convert (sizetype, max_index),
                  convert (sizetype,
                           TYPE_MIN_VALUE (TYPE_DOMAIN (TREE_TYPE (val)))));
-  i = size_binop (PLUS_EXPR, i, convert (sizetype, integer_one_node));
+  i = size_binop (PLUS_EXPR, i, build_int_cst (sizetype, 1));
 
   /* Multiply by the array element unit size to find number of bytes.  */
   i = size_binop (MULT_EXPR, i, TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (val))));