diff gcc/gimplify.c @ 57:326d9e06c2e3

modify c-parser.c
author ryoma <e075725@ie.u-ryukyu.ac.jp>
date Mon, 15 Feb 2010 00:54:17 +0900
parents 9907f3135723 77e2b8dfacca
children 1b10fe6932e1
line wrap: on
line diff
--- a/gcc/gimplify.c	Sun Feb 07 18:30:54 2010 +0900
+++ b/gcc/gimplify.c	Mon Feb 15 00:54:17 2010 +0900
@@ -56,7 +56,7 @@
 #include "cbc-tree.h"
 #endif
 
-
+#include "tree-pass.h"
 
 enum gimplify_omp_var_data
 {
@@ -71,7 +71,7 @@
   GOVD_DEBUG_PRIVATE = 256,
   GOVD_PRIVATE_OUTER_REF = 512,
   GOVD_DATA_SHARE_CLASS = (GOVD_SHARED | GOVD_PRIVATE | GOVD_FIRSTPRIVATE
-			   | GOVD_LASTPRIVATE | GOVD_REDUCTION | GOVD_LOCAL)
+               | GOVD_LASTPRIVATE | GOVD_REDUCTION | GOVD_LOCAL)
 };
 
 
@@ -111,12 +111,14 @@
 
 /* Mark X addressable.  Unlike the langhook we expect X to be in gimple
    form and we don't do any syntax checking.  */
-static void
+void
 mark_addressable (tree x)
 {
   while (handled_component_p (x))
     x = TREE_OPERAND (x, 0);
-  if (TREE_CODE (x) != VAR_DECL && TREE_CODE (x) != PARM_DECL)
+  if (TREE_CODE (x) != VAR_DECL
+      && TREE_CODE (x) != PARM_DECL
+      && TREE_CODE (x) != RESULT_DECL)
     return ;
   TREE_ADDRESSABLE (x) = 1;
 }
@@ -216,16 +218,12 @@
 pop_gimplify_context (gimple body)
 {
   struct gimplify_ctx *c = gimplify_ctxp;
-  tree t;
 
   gcc_assert (c && (c->bind_expr_stack == NULL
-		    || VEC_empty (gimple, c->bind_expr_stack)));
+            || VEC_empty (gimple, c->bind_expr_stack)));
   VEC_free (gimple, heap, c->bind_expr_stack);
   gimplify_ctxp = c->prev_context;
 
-  for (t = c->temps; t ; t = TREE_CHAIN (t))
-    DECL_GIMPLE_FORMAL_TEMP_P (t) = 0;
-
   if (body)
     declare_vars (c->temps, body, false);
   else
@@ -356,10 +354,10 @@
   if (!list)
     {
       if (t && TREE_CODE (t) == STATEMENT_LIST)
-	{
-	  *list_p = t;
-	  return;
-	}
+    {
+      *list_p = t;
+      return;
+    }
       *list_p = list = alloc_stmt_list ();
     }
 
@@ -429,62 +427,11 @@
   for (i = 2;  i < 8 && len > i;  i++)
     {
       if (name[len - i] == '.')
-	{
-	  name[len - i] = '\0';
-	  break;
-	}
-    }
-}
-
-/* Subroutine for find_single_pointer_decl.  */
-
-static tree
-find_single_pointer_decl_1 (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
-			    void *data)
-{
-  tree *pdecl = (tree *) data;
-
-  /* We are only looking for pointers at the same level as the
-     original tree; we must not look through any indirections.
-     Returning anything other than NULL_TREE will cause the caller to
-     not find a base.  */
-  if (REFERENCE_CLASS_P (*tp))
-    return *tp;
-
-  if (DECL_P (*tp) && POINTER_TYPE_P (TREE_TYPE (*tp)))
-    {
-      if (*pdecl)
-	{
-	  /* We already found a pointer decl; return anything other
-	     than NULL_TREE to unwind from walk_tree signalling that
-	     we have a duplicate.  */
-	  return *tp;
-	}
-      *pdecl = *tp;
-    }
-
-  return NULL_TREE;
-}
-
-/* Find the single DECL of pointer type in the tree T, used directly
-   rather than via an indirection, and return it.  If there are zero
-   or more than one such DECLs, return NULL.  */
-
-static tree
-find_single_pointer_decl (tree t)
-{
-  tree decl = NULL_TREE;
-
-  if (walk_tree (&t, find_single_pointer_decl_1, &decl, NULL))
-    {
-      /* find_single_pointer_decl_1 returns a nonzero value, causing
-	 walk_tree to return a nonzero value, to indicate that it
-	 found more than one pointer DECL or that it found an
-	 indirection.  */
-      return NULL_TREE;
-    }
-
-  return decl;
+    {
+      name[len - i] = '\0';
+      break;
+    }
+    }
 }
 
 /* Create a new temporary name with PREFIX.  Returns an identifier.  */
@@ -522,8 +469,9 @@
   new_type = build_type_variant (type, 0, 0);
   TYPE_ATTRIBUTES (new_type) = TYPE_ATTRIBUTES (type);
 
-  tmp_var = build_decl (VAR_DECL, prefix ? create_tmp_var_name (prefix) : NULL,
-			type);
+  tmp_var = build_decl (input_location,
+            VAR_DECL, prefix ? create_tmp_var_name (prefix) : NULL,
+            type);
 
   /* The variable was declared by the compiler.  */
   DECL_ARTIFICIAL (tmp_var) = 1;
@@ -595,24 +543,21 @@
       elt.val = val;
       if (gimplify_ctxp->temp_htab == NULL)
         gimplify_ctxp->temp_htab
-	  = htab_create (1000, gimple_tree_hash, gimple_tree_eq, free);
+      = htab_create (1000, gimple_tree_hash, gimple_tree_eq, free);
       slot = htab_find_slot (gimplify_ctxp->temp_htab, (void *)&elt, INSERT);
       if (*slot == NULL)
-	{
-	  elt_p = XNEW (elt_t);
-	  elt_p->val = val;
-	  elt_p->temp = ret = create_tmp_from_val (val);
-	  *slot = (void *) elt_p;
-	}
+    {
+      elt_p = XNEW (elt_t);
+      elt_p->val = val;
+      elt_p->temp = ret = create_tmp_from_val (val);
+      *slot = (void *) elt_p;
+    }
       else
-	{
-	  elt_p = (elt_t *) *slot;
+    {
+      elt_p = (elt_t *) *slot;
           ret = elt_p->temp;
-	}
-    }
-
-  if (is_formal)
-    DECL_GIMPLE_FORMAL_TEMP_P (ret) = 1;
+    }
+    }
 
   return ret;
 }
@@ -624,32 +569,10 @@
    gimplify_modify_expr.  */
 
 static bool
-is_gimple_formal_tmp_or_call_rhs (tree t)
-{
-  return TREE_CODE (t) == CALL_EXPR || is_gimple_formal_tmp_rhs (t);
-}
-
-/* Returns true iff T is a valid RHS for an assignment to a renamed
-   user -- or front-end generated artificial -- variable.  */
-
-static bool
-is_gimple_reg_or_call_rhs (tree t)
-{
-  /* If the RHS of the MODIFY_EXPR may throw or make a nonlocal goto
-     and the LHS is a user variable, then we need to introduce a formal
-     temporary.  This way the optimizers can determine that the user
-     variable is only modified if evaluation of the RHS does not throw.
-
-     Don't force a temp of a non-renamable type; the copy could be
-     arbitrarily expensive.  Instead we will generate a VDEF for
-     the assignment.  */
-
-  if (is_gimple_reg_type (TREE_TYPE (t))
-      && ((TREE_CODE (t) == CALL_EXPR && TREE_SIDE_EFFECTS (t))
-	  || tree_could_throw_p (t)))
-    return false;
-
-  return is_gimple_formal_tmp_or_call_rhs (t);
+is_gimple_reg_rhs_or_call (tree t)
+{
+  return (get_gimple_rhs_class (TREE_CODE (t)) != GIMPLE_INVALID_RHS
+      || TREE_CODE (t) == CALL_EXPR);
 }
 
 /* Return true if T is a valid memory RHS or a CALL_EXPR.  Note that
@@ -657,28 +580,18 @@
    rationale for this in gimplify_modify_expr.  */
 
 static bool
-is_gimple_mem_or_call_rhs (tree t)
+is_gimple_mem_rhs_or_call (tree t)
 {
   /* If we're dealing with a renamable type, either source or dest must be
      a renamed variable.  */
   if (is_gimple_reg_type (TREE_TYPE (t)))
     return is_gimple_val (t);
   else
-    return is_gimple_formal_tmp_or_call_rhs (t);
-}
-
-
-/* Returns a formal temporary variable initialized with VAL.  PRE_P is as
-   in gimplify_expr.  Only use this function if:
-
-   1) The value of the unfactored expression represented by VAL will not
-      change between the initialization and use of the temporary, and
-   2) The temporary will not be otherwise modified.
-
-   For instance, #1 means that this is inappropriate for SAVE_EXPR temps,
-   and #2 means it is inappropriate for && temps.
-
-   For other cases, use get_initialized_tmp_var instead.  */
+    return (is_gimple_val (t) || is_gimple_lvalue (t)
+        || TREE_CODE (t) == CALL_EXPR);
+}
+
+/* Helper for get_formal_tmp_var and get_initialized_tmp_var.  */
 
 static tree
 internal_get_tmp_var (tree val, gimple_seq *pre_p, gimple_seq *post_p,
@@ -688,37 +601,20 @@
 
   /* Notice that we explicitly allow VAL to be a CALL_EXPR so that we
      can create an INIT_EXPR and convert it into a GIMPLE_CALL below.  */
-  gimplify_expr (&val, pre_p, post_p, is_gimple_formal_tmp_or_call_rhs,
-		 fb_rvalue);
+  gimplify_expr (&val, pre_p, post_p, is_gimple_reg_rhs_or_call,
+         fb_rvalue);
 
   t = lookup_tmp_var (val, is_formal);
 
-  if (is_formal)
-    {
-      tree u = find_single_pointer_decl (val);
-
-      if (u && TREE_CODE (u) == VAR_DECL && DECL_BASED_ON_RESTRICT_P (u))
-	u = DECL_GET_RESTRICT_BASE (u);
-      if (u && TYPE_RESTRICT (TREE_TYPE (u)))
-	{
-	  if (DECL_BASED_ON_RESTRICT_P (t))
-	    gcc_assert (u == DECL_GET_RESTRICT_BASE (t));
-	  else
-	    {
-	      DECL_BASED_ON_RESTRICT_P (t) = 1;
-	      SET_DECL_RESTRICT_BASE (t, u);
-	    }
-	}
-    }
-
-  if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE
-      || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
+  if (is_formal
+      && (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE
+      || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE))
     DECL_GIMPLE_REG_P (t) = 1;
 
   mod = build2 (INIT_EXPR, TREE_TYPE (t), t, unshare_expr (val));
 
   if (EXPR_HAS_LOCATION (val))
-    SET_EXPR_LOCUS (mod, EXPR_LOCUS (val));
+    SET_EXPR_LOCATION (mod, EXPR_LOCATION (val));
   else
     SET_EXPR_LOCATION (mod, input_location);
 
@@ -737,9 +633,17 @@
   return t;
 }
 
-/* Returns a formal temporary variable initialized with VAL.  PRE_P
-   points to a sequence where side-effects needed to compute VAL should be
-   stored.  */
+/* Returns a formal temporary variable initialized with VAL.  PRE_P is as
+   in gimplify_expr.  Only use this function if:
+
+   1) The value of the unfactored expression represented by VAL will not
+      change between the initialization and use of the temporary, and
+   2) The temporary will not be otherwise modified.
+
+   For instance, #1 means that this is inappropriate for SAVE_EXPR temps,
+   and #2 means it is inappropriate for && temps.
+
+   For other cases, use get_initialized_tmp_var instead.  */
 
 tree
 get_formal_tmp_var (tree val, gimple_seq *pre_p)
@@ -774,25 +678,25 @@
       block = gimple_bind_block (scope);
       gcc_assert (!block || TREE_CODE (block) == BLOCK);
       if (!block || !debug_info)
-	{
-	  TREE_CHAIN (last) = gimple_bind_vars (scope);
-	  gimple_bind_set_vars (scope, temps);
-	}
+    {
+      TREE_CHAIN (last) = gimple_bind_vars (scope);
+      gimple_bind_set_vars (scope, temps);
+    }
       else
-	{
-	  /* We need to attach the nodes both to the BIND_EXPR and to its
-	     associated BLOCK for debugging purposes.  The key point here
-	     is that the BLOCK_VARS of the BIND_EXPR_BLOCK of a BIND_EXPR
-	     is a subchain of the BIND_EXPR_VARS of the BIND_EXPR.  */
-	  if (BLOCK_VARS (block))
-	    BLOCK_VARS (block) = chainon (BLOCK_VARS (block), temps);
-	  else
-	    {
-	      gimple_bind_set_vars (scope,
-	      			    chainon (gimple_bind_vars (scope), temps));
-	      BLOCK_VARS (block) = temps;
-	    }
-	}
+    {
+      /* We need to attach the nodes both to the BIND_EXPR and to its
+         associated BLOCK for debugging purposes.  The key point here
+         is that the BLOCK_VARS of the BIND_EXPR_BLOCK of a BIND_EXPR
+         is a subchain of the BIND_EXPR_VARS of the BIND_EXPR.  */
+      if (BLOCK_VARS (block))
+        BLOCK_VARS (block) = chainon (BLOCK_VARS (block), temps);
+      else
+        {
+          gimple_bind_set_vars (scope,
+                        chainon (gimple_bind_vars (scope), temps));
+          BLOCK_VARS (block) = temps;
+        }
+    }
     }
 }
 
@@ -841,13 +745,13 @@
 
       /* Mark temporaries local within the nearest enclosing parallel.  */
       if (gimplify_omp_ctxp)
-	{
-	  struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp;
-	  while (ctx && ctx->region_type == ORT_WORKSHARE)
-	    ctx = ctx->outer_context;
-	  if (ctx)
-	    omp_add_variable (ctx, tmp, GOVD_LOCAL | GOVD_SEEN);
-	}
+    {
+      struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp;
+      while (ctx && ctx->region_type == ORT_WORKSHARE)
+        ctx = ctx->outer_context;
+      if (ctx)
+        omp_add_variable (ctx, tmp, GOVD_LOCAL | GOVD_SEEN);
+    }
     }
   else if (cfun)
     record_vars (tmp);
@@ -856,7 +760,7 @@
       gimple_seq body_seq;
 
       /* This case is for nested functions.  We need to expose the locals
-	 they create.  */
+     they create.  */
       body_seq = gimple_body (current_function_decl);
       declare_vars (tmp, gimple_seq_first_stmt (body_seq), false);
     }
@@ -876,23 +780,6 @@
   return true;
 }
 
-/* Same, but for a tree.  */
-
-static bool
-tree_should_carry_location_p (const_tree stmt)
-{
-  /* Don't emit a line note for a label.  We particularly don't want to
-     emit one for the break label, since it doesn't actually correspond
-     to the beginning of the loop/switch.  */
-  if (TREE_CODE (stmt) == LABEL_EXPR)
-    return false;
-
-  /* Do not annotate empty statements, since it confuses gcov.  */
-  if (!TREE_SIDE_EFFECTS (stmt))
-    return false;
-
-  return true;
-}
 
 /* Return true if a location should not be emitted for this statement
    by annotate_one_with_location.  */
@@ -914,27 +801,17 @@
   gimple_set_plf (g, GF_PLF_1, true);
 }
 
-/* Set the location for gimple statement GS to LOCUS.  */
+/* Set the location for gimple statement GS to LOCATION.  */
 
 static void
 annotate_one_with_location (gimple gs, location_t location)
 {
-  if (!gimple_has_location (gs) 
+  if (!gimple_has_location (gs)
       && !gimple_do_not_emit_location_p (gs)
       && should_carry_location_p (gs))
     gimple_set_location (gs, location);
 }
 
-/* Same, but for tree T.  */
-
-static void
-tree_annotate_one_with_location (tree t, location_t location)
-{
-  if (CAN_HAVE_LOCATION_P (t)
-      && ! EXPR_HAS_LOCATION (t) && tree_should_carry_location_p (t))
-    SET_EXPR_LOCATION (t, location);
-}
-
 
 /* Set LOCATION for all the statements after iterator GSI in sequence
    SEQ.  If GSI is pointing to the end of the sequence, start with the
@@ -942,7 +819,7 @@
 
 static void
 annotate_all_with_location_after (gimple_seq seq, gimple_stmt_iterator gsi,
-				  location_t location)
+                  location_t location)
 {
   if (gsi_end_p (gsi))
     gsi = gsi_start (seq);
@@ -954,7 +831,7 @@
 }
 
 
-/* Set the location for all the statements in a sequence STMT_P to LOCUS.  */
+/* Set the location for all the statements in a sequence STMT_P to LOCATION.  */
 
 void
 annotate_all_with_location (gimple_seq stmt_p, location_t location)
@@ -971,29 +848,6 @@
     }
 }
 
-/* Same, but for statement or statement list in *STMT_P.  */
-
-void
-tree_annotate_all_with_location (tree *stmt_p, location_t location)
-{
-  tree_stmt_iterator i;
-
-  if (!*stmt_p)
-    return;
-
-  for (i = tsi_start (*stmt_p); !tsi_end_p (i); tsi_next (&i))
-    {
-      tree t = tsi_stmt (i);
-
-      /* Assuming we've already been gimplified, we shouldn't
-	  see nested chaining constructs anymore.  */
-      gcc_assert (TREE_CODE (t) != STATEMENT_LIST
-		  && TREE_CODE (t) != COMPOUND_EXPR);
-
-      tree_annotate_one_with_location (t, location);
-    }
-}
-
 
 /* Similar to copy_tree_r() but do not copy SAVE_EXPR or TARGET_EXPR nodes.
    These nodes model computations that should only be done once.  If we
@@ -1010,8 +864,8 @@
       || TREE_CODE_CLASS (code) == tcc_constant
       || code == SAVE_EXPR || code == TARGET_EXPR
       /* We can't do anything sensible with a BLOCK used as an expression,
-	 but we also can't just die when we see it because of non-expression
-	 uses.  So just avert our eyes and cross our fingers.  Silly Java.  */
+     but we also can't just die when we see it because of non-expression
+     uses.  So just avert our eyes and cross our fingers.  Silly Java.  */
       || code == BLOCK)
     *walk_subtrees = 0;
   else
@@ -1034,7 +888,7 @@
 
 static tree
 copy_if_shared_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
-		  void *data ATTRIBUTE_UNUSED)
+          void *data ATTRIBUTE_UNUSED)
 {
   tree t = *tp;
   enum tree_code code = TREE_CODE (t);
@@ -1048,9 +902,9 @@
       || TREE_CODE_CLASS (code) == tcc_constant)
     {
       if (TREE_VISITED (t))
-	*walk_subtrees = 0;
+    *walk_subtrees = 0;
       else
-	TREE_VISITED (t) = 1;
+    TREE_VISITED (t) = 1;
     }
 
   /* If this node has been visited already, unshare it and don't look
@@ -1070,7 +924,7 @@
 
 static tree
 unmark_visited_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED,
-		  void *data ATTRIBUTE_UNUSED)
+          void *data ATTRIBUTE_UNUSED)
 {
   if (TREE_VISITED (*tp))
     TREE_VISITED (*tp) = 0;
@@ -1133,66 +987,66 @@
       tree *p;
 
       /* Set p to point to the body of the wrapper.  Loop until we find
-	 something that isn't a wrapper.  */
+     something that isn't a wrapper.  */
       for (p = &wrapper; p && *p; )
-	{
-	  switch (TREE_CODE (*p))
-	    {
-	    case BIND_EXPR:
-	      TREE_SIDE_EFFECTS (*p) = 1;
-	      TREE_TYPE (*p) = void_type_node;
-	      /* For a BIND_EXPR, the body is operand 1.  */
-	      p = &BIND_EXPR_BODY (*p);
-	      break;
-
-	    case CLEANUP_POINT_EXPR:
-	    case TRY_FINALLY_EXPR:
-	    case TRY_CATCH_EXPR:
-	      TREE_SIDE_EFFECTS (*p) = 1;
-	      TREE_TYPE (*p) = void_type_node;
-	      p = &TREE_OPERAND (*p, 0);
-	      break;
-
-	    case STATEMENT_LIST:
-	      {
-		tree_stmt_iterator i = tsi_last (*p);
-		TREE_SIDE_EFFECTS (*p) = 1;
-		TREE_TYPE (*p) = void_type_node;
-		p = tsi_end_p (i) ? NULL : tsi_stmt_ptr (i);
-	      }
-	      break;
-
-	    case COMPOUND_EXPR:
-	      /* Advance to the last statement.  Set all container types to void.  */
-	      for (; TREE_CODE (*p) == COMPOUND_EXPR; p = &TREE_OPERAND (*p, 1))
-		{
-		  TREE_SIDE_EFFECTS (*p) = 1;
-		  TREE_TYPE (*p) = void_type_node;
-		}
-	      break;
-
-	    default:
-	      goto out;
-	    }
-	}
+    {
+      switch (TREE_CODE (*p))
+        {
+        case BIND_EXPR:
+          TREE_SIDE_EFFECTS (*p) = 1;
+          TREE_TYPE (*p) = void_type_node;
+          /* For a BIND_EXPR, the body is operand 1.  */
+          p = &BIND_EXPR_BODY (*p);
+          break;
+
+        case CLEANUP_POINT_EXPR:
+        case TRY_FINALLY_EXPR:
+        case TRY_CATCH_EXPR:
+          TREE_SIDE_EFFECTS (*p) = 1;
+          TREE_TYPE (*p) = void_type_node;
+          p = &TREE_OPERAND (*p, 0);
+          break;
+
+        case STATEMENT_LIST:
+          {
+        tree_stmt_iterator i = tsi_last (*p);
+        TREE_SIDE_EFFECTS (*p) = 1;
+        TREE_TYPE (*p) = void_type_node;
+        p = tsi_end_p (i) ? NULL : tsi_stmt_ptr (i);
+          }
+          break;
+
+        case COMPOUND_EXPR:
+          /* Advance to the last statement.  Set all container types to void.  */
+          for (; TREE_CODE (*p) == COMPOUND_EXPR; p = &TREE_OPERAND (*p, 1))
+        {
+          TREE_SIDE_EFFECTS (*p) = 1;
+          TREE_TYPE (*p) = void_type_node;
+        }
+          break;
+
+        default:
+          goto out;
+        }
+    }
 
     out:
       if (p == NULL || IS_EMPTY_STMT (*p))
-	temp = NULL_TREE;
+    temp = NULL_TREE;
       else if (temp)
-	{
-	  /* The wrapper is on the RHS of an assignment that we're pushing
-	     down.  */
-	  gcc_assert (TREE_CODE (temp) == INIT_EXPR
-		      || TREE_CODE (temp) == MODIFY_EXPR);
-	  TREE_OPERAND (temp, 1) = *p;
-	  *p = temp;
-	}
+    {
+      /* The wrapper is on the RHS of an assignment that we're pushing
+         down.  */
+      gcc_assert (TREE_CODE (temp) == INIT_EXPR
+              || TREE_CODE (temp) == MODIFY_EXPR);
+      TREE_OPERAND (temp, 1) = *p;
+      *p = temp;
+    }
       else
-	{
-	  temp = create_tmp_var (type, "retval");
-	  *p = build2 (INIT_EXPR, type, temp, *p);
-	}
+    {
+      temp = create_tmp_var (type, "retval");
+      *p = build2 (INIT_EXPR, type, temp, *p);
+    }
 
       return temp;
     }
@@ -1213,7 +1067,7 @@
   gimple_call_set_lhs (*save, tmp_var);
 
   *restore = gimple_build_call (implicit_built_in_decls[BUILT_IN_STACK_RESTORE],
-			    1, tmp_var);
+                1, tmp_var);
 }
 
 /* Gimplify a BIND_EXPR.  Just voidify and recurse.  */
@@ -1233,31 +1087,36 @@
   for (t = BIND_EXPR_VARS (bind_expr); t ; t = TREE_CHAIN (t))
     {
       if (TREE_CODE (t) == VAR_DECL)
-	{
-	  struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp;
-
-	  /* Mark variable as local.  */
-	  if (ctx && !is_global_var (t)
-	      && (! DECL_SEEN_IN_BIND_EXPR_P (t)
-		  || splay_tree_lookup (ctx->variables,
-					(splay_tree_key) t) == NULL))
-	    omp_add_variable (gimplify_omp_ctxp, t, GOVD_LOCAL | GOVD_SEEN);
-
-	  DECL_SEEN_IN_BIND_EXPR_P (t) = 1;
-
-	  if (DECL_HARD_REGISTER (t) && !is_global_var (t) && cfun)
-	    cfun->has_local_explicit_reg_vars = true;
-	}
+    {
+      struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp;
+
+      /* Mark variable as local.  */
+      if (ctx && !is_global_var (t)
+          && (! DECL_SEEN_IN_BIND_EXPR_P (t)
+          || splay_tree_lookup (ctx->variables,
+                    (splay_tree_key) t) == NULL))
+        omp_add_variable (gimplify_omp_ctxp, t, GOVD_LOCAL | GOVD_SEEN);
+
+      DECL_SEEN_IN_BIND_EXPR_P (t) = 1;
+
+      if (DECL_HARD_REGISTER (t) && !is_global_var (t) && cfun)
+        cfun->has_local_explicit_reg_vars = true;
+    }
 
       /* Preliminarily mark non-addressed complex variables as eligible
-	 for promotion to gimple registers.  We'll transform their uses
-	 as we find them.  */
-      if ((TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE
-	   || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
-	  && !TREE_THIS_VOLATILE (t)
-	  && (TREE_CODE (t) == VAR_DECL && !DECL_HARD_REGISTER (t))
-	  && !needs_to_live_in_memory (t))
-	DECL_GIMPLE_REG_P (t) = 1;
+     for promotion to gimple registers.  We'll transform their uses
+     as we find them.
+     We exclude complex types if not optimizing because they can be
+     subject to partial stores in GNU C by means of the __real__ and
+     __imag__ operators and we cannot promote them to total stores
+     (see gimplify_modify_expr_complex_part).  */
+      if (optimize
+      && (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE
+          || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)
+      && !TREE_THIS_VOLATILE (t)
+      && (TREE_CODE (t) == VAR_DECL && !DECL_HARD_REGISTER (t))
+      && !needs_to_live_in_memory (t))
+    DECL_GIMPLE_REG_P (t) = 1;
     }
 
   gimple_bind = gimple_build_bind (BIND_EXPR_VARS (bind_expr), NULL,
@@ -1277,14 +1136,14 @@
       gimple_seq cleanup, new_body;
 
       /* Save stack on entry and restore it on exit.  Add a try_finally
-	 block to achieve this.  Note that mudflap depends on the
-	 format of the emitted code: see mx_register_decls().  */
+     block to achieve this.  Note that mudflap depends on the
+     format of the emitted code: see mx_register_decls().  */
       build_stack_save_restore (&stack_save, &stack_restore);
 
       cleanup = new_body = NULL;
       gimplify_seq_add_stmt (&cleanup, stack_restore);
       gs = gimple_build_try (gimple_bind_body (gimple_bind), cleanup,
-	  		     GIMPLE_TRY_FINALLY);
+                 GIMPLE_TRY_FINALLY);
 
       gimplify_seq_add_stmt (&new_body, stack_save);
       gimplify_seq_add_stmt (&new_body, gs);
@@ -1333,14 +1192,14 @@
       return GS_ALL_DONE;
     }
 
-  if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl))) 
+  if (VOID_TYPE_P (TREE_TYPE (TREE_TYPE (current_function_decl)))
 #ifndef noCbC
       || ( ret_expr
            && TREE_CODE(ret_expr)==CALL_EXPR
-	   && CbC_IS_CbC_GOTO(ret_expr) 
-	   //&& !CbC_IS_CODE_SEGMENT(TREE_TYPE(current_function_decl)))
-	   && !(current_function_decl&&CbC_IS_CODE_SEGMENT(TREE_TYPE(current_function_decl))))
-	   //&& !(current_function_decl&&CbC_IS_CODE_SEGMENT(current_function_decl)))
+       && CbC_IS_CbC_GOTO(ret_expr)
+       //&& !CbC_IS_CODE_SEGMENT(TREE_TYPE(current_function_decl)))
+       && !(current_function_decl&&CbC_IS_CODE_SEGMENT(TREE_TYPE(current_function_decl))))
+       //&& !(current_function_decl&&CbC_IS_CODE_SEGMENT(current_function_decl)))
 #endif
      )
     result_decl = NULL_TREE;
@@ -1350,11 +1209,11 @@
 
       /* See through a return by reference.  */
       if (TREE_CODE (result_decl) == INDIRECT_REF)
-	result_decl = TREE_OPERAND (result_decl, 0);
+    result_decl = TREE_OPERAND (result_decl, 0);
 
       gcc_assert ((TREE_CODE (ret_expr) == MODIFY_EXPR
-		   || TREE_CODE (ret_expr) == INIT_EXPR)
-		  && TREE_CODE (result_decl) == RESULT_DECL);
+           || TREE_CODE (ret_expr) == INIT_EXPR)
+          && TREE_CODE (result_decl) == RESULT_DECL);
     }
 
   /* If aggregate_value_p is true, then we can return the bare RESULT_DECL.
@@ -1378,9 +1237,9 @@
         DECL_GIMPLE_REG_P (result) = 1;
 
       /* ??? With complex control flow (usually involving abnormal edges),
-	 we can wind up warning about an uninitialized value for this.  Due
-	 to how this variable is constructed and initialized, this is never
-	 true.  Give up and never warn.  */
+     we can wind up warning about an uninitialized value for this.  Due
+     to how this variable is constructed and initialized, this is never
+     true.  Give up and never warn.  */
       TREE_NO_WARNING (result) = 1;
 
       gimplify_ctxp->return_temp = result;
@@ -1460,34 +1319,34 @@
       tree init = DECL_INITIAL (decl);
 
       if (TREE_CODE (DECL_SIZE_UNIT (decl)) != INTEGER_CST
-	  || (!TREE_STATIC (decl)
-	      && flag_stack_check == GENERIC_STACK_CHECK
-	      && compare_tree_int (DECL_SIZE_UNIT (decl),
-				   STACK_CHECK_MAX_VAR_SIZE) > 0))
-	gimplify_vla_decl (decl, seq_p);
+      || (!TREE_STATIC (decl)
+          && flag_stack_check == GENERIC_STACK_CHECK
+          && compare_tree_int (DECL_SIZE_UNIT (decl),
+                   STACK_CHECK_MAX_VAR_SIZE) > 0))
+    gimplify_vla_decl (decl, seq_p);
 
       if (init && init != error_mark_node)
-	{
-	  if (!TREE_STATIC (decl))
-	    {
-	      DECL_INITIAL (decl) = NULL_TREE;
-	      init = build2 (INIT_EXPR, void_type_node, decl, init);
-	      gimplify_and_add (init, seq_p);
-	      ggc_free (init);
-	    }
-	  else
-	    /* We must still examine initializers for static variables
-	       as they may contain a label address.  */
-	    walk_tree (&init, force_labels_r, NULL, NULL);
-	}
+    {
+      if (!TREE_STATIC (decl))
+        {
+          DECL_INITIAL (decl) = NULL_TREE;
+          init = build2 (INIT_EXPR, void_type_node, decl, init);
+          gimplify_and_add (init, seq_p);
+          ggc_free (init);
+        }
+      else
+        /* We must still examine initializers for static variables
+           as they may contain a label address.  */
+        walk_tree (&init, force_labels_r, NULL, NULL);
+    }
 
       /* Some front ends do not explicitly declare all anonymous
-	 artificial variables.  We compensate here by declaring the
-	 variables, though it would be better if the front ends would
-	 explicitly declare them.  */
+     artificial variables.  We compensate here by declaring the
+     variables, though it would be better if the front ends would
+     explicitly declare them.  */
       if (!DECL_SEEN_IN_BIND_EXPR_P (decl)
-	  && DECL_ARTIFICIAL (decl) && DECL_NAME (decl) == NULL_TREE)
-	gimple_add_tmp_var (decl);
+      && DECL_ARTIFICIAL (decl) && DECL_NAME (decl) == NULL_TREE)
+    gimple_add_tmp_var (decl);
     }
 
   return GS_ALL_DONE;
@@ -1501,7 +1360,7 @@
 gimplify_loop_expr (tree *expr_p, gimple_seq *pre_p)
 {
   tree saved_label = gimplify_ctxp->exit_label;
-  tree start_label = create_artificial_label ();
+  tree start_label = create_artificial_label (UNKNOWN_LOCATION);
 
   gimplify_seq_add_stmt (pre_p, gimple_build_label (start_label));
 
@@ -1598,12 +1457,12 @@
       tree default_case = NULL_TREE;
       size_t i, len;
       gimple gimple_switch;
-      
+
       /* If someone can be bothered to fill in the labels, they can
-	 be bothered to null out the body too.  */
+     be bothered to null out the body too.  */
       gcc_assert (!SWITCH_LABELS (switch_expr));
 
-      /* save old labels, get new ones from body, then restore the old 
+      /* save old labels, get new ones from body, then restore the old
          labels.  Save all the things from the switch body to append after.  */
       saved_labels = gimplify_ctxp->case_labels;
       gimplify_ctxp->case_labels = VEC_alloc (tree, heap, 8);
@@ -1611,95 +1470,96 @@
       gimplify_stmt (&SWITCH_BODY (switch_expr), &switch_body_seq);
       labels = gimplify_ctxp->case_labels;
       gimplify_ctxp->case_labels = saved_labels;
- 
+
       i = 0;
       while (i < VEC_length (tree, labels))
-	{
-	  tree elt = VEC_index (tree, labels, i);
-	  tree low = CASE_LOW (elt);
-	  bool remove_element = FALSE;
-
-	  if (low)
-	    {
-	      /* Discard empty ranges.  */
-	      tree high = CASE_HIGH (elt);
-	      if (high && tree_int_cst_lt (high, low))
-	        remove_element = TRUE;
-	    }
-	  else
-	    {
-	      /* The default case must be the last label in the list.  */
-	      gcc_assert (!default_case);
-	      default_case = elt;
-	      remove_element = TRUE;
-	    }
-
-	  if (remove_element)
-	    VEC_ordered_remove (tree, labels, i);
-	  else
-	    i++;
-	}
+    {
+      tree elt = VEC_index (tree, labels, i);
+      tree low = CASE_LOW (elt);
+      bool remove_element = FALSE;
+
+      if (low)
+        {
+          /* Discard empty ranges.  */
+          tree high = CASE_HIGH (elt);
+          if (high && tree_int_cst_lt (high, low))
+            remove_element = TRUE;
+        }
+      else
+        {
+          /* The default case must be the last label in the list.  */
+          gcc_assert (!default_case);
+          default_case = elt;
+          remove_element = TRUE;
+        }
+
+      if (remove_element)
+        VEC_ordered_remove (tree, labels, i);
+      else
+        i++;
+    }
       len = i;
 
       if (!VEC_empty (tree, labels))
-	sort_case_labels (labels);
+    sort_case_labels (labels);
 
       if (!default_case)
-	{
-	  tree type = TREE_TYPE (switch_expr);
-
-	  /* If the switch has no default label, add one, so that we jump
-	     around the switch body.  If the labels already cover the whole
-	     range of type, add the default label pointing to one of the
-	     existing labels.  */
-	  if (type == void_type_node)
-	    type = TREE_TYPE (SWITCH_COND (switch_expr));
-	  if (len
-	      && INTEGRAL_TYPE_P (type)
-	      && TYPE_MIN_VALUE (type)
-	      && TYPE_MAX_VALUE (type)
-	      && tree_int_cst_equal (CASE_LOW (VEC_index (tree, labels, 0)),
-				     TYPE_MIN_VALUE (type)))
-	    {
-	      tree low, high = CASE_HIGH (VEC_index (tree, labels, len - 1));
-	      if (!high)
-		high = CASE_LOW (VEC_index (tree, labels, len - 1));
-	      if (tree_int_cst_equal (high, TYPE_MAX_VALUE (type)))
-		{
-		  for (i = 1; i < len; i++)
-		    {
-		      high = CASE_LOW (VEC_index (tree, labels, i));
-		      low = CASE_HIGH (VEC_index (tree, labels, i - 1));
-		      if (!low)
-			low = CASE_LOW (VEC_index (tree, labels, i - 1));
-		      if ((TREE_INT_CST_LOW (low) + 1
-			   != TREE_INT_CST_LOW (high))
-			  || (TREE_INT_CST_HIGH (low)
-			      + (TREE_INT_CST_LOW (high) == 0)
-			      != TREE_INT_CST_HIGH (high)))
-			break;
-		    }
-		  if (i == len)
-		    default_case = build3 (CASE_LABEL_EXPR, void_type_node,
-					   NULL_TREE, NULL_TREE,
-					   CASE_LABEL (VEC_index (tree,
-								  labels, 0)));
-		}
-	    }
-
-	  if (!default_case)
-	    {
-	      gimple new_default;
-
-	      default_case = build3 (CASE_LABEL_EXPR, void_type_node,
-				     NULL_TREE, NULL_TREE,
-				     create_artificial_label ());
-	      new_default = gimple_build_label (CASE_LABEL (default_case));
-	      gimplify_seq_add_stmt (&switch_body_seq, new_default);
-	    }
-	}
-
-      gimple_switch = gimple_build_switch_vec (SWITCH_COND (switch_expr), 
+    {
+      tree type = TREE_TYPE (switch_expr);
+
+      /* If the switch has no default label, add one, so that we jump
+         around the switch body.  If the labels already cover the whole
+         range of type, add the default label pointing to one of the
+         existing labels.  */
+      if (type == void_type_node)
+        type = TREE_TYPE (SWITCH_COND (switch_expr));
+      if (len
+          && INTEGRAL_TYPE_P (type)
+          && TYPE_MIN_VALUE (type)
+          && TYPE_MAX_VALUE (type)
+          && tree_int_cst_equal (CASE_LOW (VEC_index (tree, labels, 0)),
+                     TYPE_MIN_VALUE (type)))
+        {
+          tree low, high = CASE_HIGH (VEC_index (tree, labels, len - 1));
+          if (!high)
+        high = CASE_LOW (VEC_index (tree, labels, len - 1));
+          if (tree_int_cst_equal (high, TYPE_MAX_VALUE (type)))
+        {
+          for (i = 1; i < len; i++)
+            {
+              high = CASE_LOW (VEC_index (tree, labels, i));
+              low = CASE_HIGH (VEC_index (tree, labels, i - 1));
+              if (!low)
+            low = CASE_LOW (VEC_index (tree, labels, i - 1));
+              if ((TREE_INT_CST_LOW (low) + 1
+               != TREE_INT_CST_LOW (high))
+              || (TREE_INT_CST_HIGH (low)
+                  + (TREE_INT_CST_LOW (high) == 0)
+                  != TREE_INT_CST_HIGH (high)))
+            break;
+            }
+          if (i == len)
+            default_case = build3 (CASE_LABEL_EXPR, void_type_node,
+                       NULL_TREE, NULL_TREE,
+                       CASE_LABEL (VEC_index (tree,
+                                  labels, 0)));
+        }
+        }
+
+      if (!default_case)
+        {
+          gimple new_default;
+
+          default_case
+        = build3 (CASE_LABEL_EXPR, void_type_node,
+              NULL_TREE, NULL_TREE,
+              create_artificial_label (UNKNOWN_LOCATION));
+          new_default = gimple_build_label (CASE_LABEL (default_case));
+          gimplify_seq_add_stmt (&switch_body_seq, new_default);
+        }
+    }
+
+      gimple_switch = gimple_build_switch_vec (SWITCH_COND (switch_expr),
                                                default_case, labels);
       gimplify_seq_add_stmt (pre_p, gimple_switch);
       gimplify_seq_add_seq (pre_p, switch_body_seq);
@@ -1744,7 +1604,7 @@
 
   if (*label_p == NULL_TREE)
     {
-      tree label = create_artificial_label ();
+      tree label = create_artificial_label (UNKNOWN_LOCATION);
       *label_p = label;
     }
 
@@ -1816,18 +1676,18 @@
       int type_quals;
 
       /* We need to preserve qualifiers and propagate them from
-	 operand 0.  */
+     operand 0.  */
       type_quals = TYPE_QUALS (type)
-	| TYPE_QUALS (TREE_TYPE (TREE_OPERAND (expr, 0)));
+    | TYPE_QUALS (TREE_TYPE (TREE_OPERAND (expr, 0)));
       if (TYPE_QUALS (type) != type_quals)
-	type = build_qualified_type (TYPE_MAIN_VARIANT (type), type_quals);
+    type = build_qualified_type (TYPE_MAIN_VARIANT (type), type_quals);
 
       /* Set the type of the COMPONENT_REF to the underlying type.  */
       TREE_TYPE (expr) = type;
 
 #ifdef ENABLE_TYPES_CHECKING
       /* It is now a FE error, if the conversion from the canonical
-	 type to the original expression type is not useless.  */
+     type to the original expression type is not useless.  */
       gcc_assert (useless_type_conversion_p (old_type, type));
 #endif
     }
@@ -1865,7 +1725,8 @@
      the expression pointer type.  */
   ddatype = TREE_TYPE (datype);
   pddatype = build_pointer_type (ddatype);
-  if (!useless_type_conversion_p (pddatype, ddatype))
+  if (!useless_type_conversion_p (TYPE_MAIN_VARIANT (TREE_TYPE (expr)),
+                  pddatype))
     return;
 
   /* The lower bound and element sizes must be constant.  */
@@ -1877,9 +1738,13 @@
 
   /* All checks succeeded.  Build a new node to merge the cast.  */
   *expr_p = build4 (ARRAY_REF, ddatype, TREE_OPERAND (addr_expr, 0),
-		    TYPE_MIN_VALUE (TYPE_DOMAIN (datype)),
-		    NULL_TREE, NULL_TREE);
+            TYPE_MIN_VALUE (TYPE_DOMAIN (datype)),
+            NULL_TREE, NULL_TREE);
   *expr_p = build1 (ADDR_EXPR, pddatype, *expr_p);
+
+  /* We can have stripped a required restrict qualifier above.  */
+  if (!useless_type_conversion_p (TREE_TYPE (expr), TREE_TYPE (*expr_p)))
+    *expr_p = fold_convert (TREE_TYPE (expr), *expr_p);
 }
 
 /* *EXPR_P is a NOP_EXPR or CONVERT_EXPR.  Remove it and/or other conversions
@@ -1889,8 +1754,9 @@
 gimplify_conversion (tree *expr_p)
 {
   tree tem;
+  location_t loc = EXPR_LOCATION (*expr_p);
   gcc_assert (CONVERT_EXPR_P (*expr_p));
-  
+
   /* Then strip away all but the outermost conversion.  */
   STRIP_SIGN_NOPS (TREE_OPERAND (*expr_p, 0));
 
@@ -1905,8 +1771,8 @@
       && POINTER_TYPE_P (TREE_TYPE (*expr_p))
       && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (*expr_p, 0)))
       && (tem = maybe_fold_offset_to_address
-		  (TREE_OPERAND (*expr_p, 0),
-		   integer_zero_node, TREE_TYPE (*expr_p))) != NULL_TREE)
+      (EXPR_LOCATION (*expr_p), TREE_OPERAND (*expr_p, 0),
+       integer_zero_node, TREE_TYPE (*expr_p))) != NULL_TREE)
     *expr_p = tem;
 
   /* If we still have a conversion at the toplevel,
@@ -1916,27 +1782,30 @@
       tree sub = TREE_OPERAND (*expr_p, 0);
 
       /* If a NOP conversion is changing the type of a COMPONENT_REF
-	 expression, then canonicalize its type now in order to expose more
-	 redundant conversions.  */
+     expression, then canonicalize its type now in order to expose more
+     redundant conversions.  */
       if (TREE_CODE (sub) == COMPONENT_REF)
-	canonicalize_component_ref (&TREE_OPERAND (*expr_p, 0));
+    canonicalize_component_ref (&TREE_OPERAND (*expr_p, 0));
 
       /* If a NOP conversion is changing a pointer to array of foo
-	 to a pointer to foo, embed that change in the ADDR_EXPR.  */
+     to a pointer to foo, embed that change in the ADDR_EXPR.  */
       else if (TREE_CODE (sub) == ADDR_EXPR)
-	canonicalize_addr_expr (expr_p);
+    canonicalize_addr_expr (expr_p);
     }
 
   /* If we have a conversion to a non-register type force the
      use of a VIEW_CONVERT_EXPR instead.  */
   if (CONVERT_EXPR_P (*expr_p) && !is_gimple_reg_type (TREE_TYPE (*expr_p)))
-    *expr_p = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (*expr_p),
-			   TREE_OPERAND (*expr_p, 0));
+    *expr_p = fold_build1_loc (loc, VIEW_CONVERT_EXPR, TREE_TYPE (*expr_p),
+                   TREE_OPERAND (*expr_p, 0));
 
   return GS_OK;
 }
 
-/* Gimplify a VAR_DECL or PARM_DECL.  Returns GS_OK if we expanded a 
+/* Nonlocal VLAs seen in the current function.  */
+static struct pointer_set_t *nonlocal_vlas;
+
+/* Gimplify a VAR_DECL or PARM_DECL.  Returns GS_OK if we expanded a
    DECL_VALUE_EXPR, and it's worth re-examining things.  */
 
 static enum gimplify_status
@@ -1966,7 +1835,36 @@
   /* If the decl is an alias for another expression, substitute it now.  */
   if (DECL_HAS_VALUE_EXPR_P (decl))
     {
-      *expr_p = unshare_expr (DECL_VALUE_EXPR (decl));
+      tree value_expr = DECL_VALUE_EXPR (decl);
+
+      /* For referenced nonlocal VLAs add a decl for debugging purposes
+     to the current function.  */
+      if (TREE_CODE (decl) == VAR_DECL
+      && TREE_CODE (DECL_SIZE_UNIT (decl)) != INTEGER_CST
+      && nonlocal_vlas != NULL
+      && TREE_CODE (value_expr) == INDIRECT_REF
+      && TREE_CODE (TREE_OPERAND (value_expr, 0)) == VAR_DECL
+      && decl_function_context (decl) != current_function_decl)
+    {
+      struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp;
+      while (ctx && ctx->region_type == ORT_WORKSHARE)
+        ctx = ctx->outer_context;
+      if (!ctx && !pointer_set_insert (nonlocal_vlas, decl))
+        {
+          tree copy = copy_node (decl), block;
+
+          lang_hooks.dup_lang_specific_decl (copy);
+          SET_DECL_RTL (copy, NULL_RTX);
+          TREE_USED (copy) = 1;
+          block = DECL_INITIAL (current_function_decl);
+          TREE_CHAIN (copy) = BLOCK_VARS (block);
+          BLOCK_VARS (block) = copy;
+          SET_DECL_VALUE_EXPR (copy, unshare_expr (value_expr));
+          DECL_HAS_VALUE_EXPR_P (copy) = 1;
+        }
+    }
+
+      *expr_p = unshare_expr (value_expr);
       return GS_OK;
     }
 
@@ -1978,10 +1876,10 @@
    node *EXPR_P.
 
       compound_lval
-	      : min_lval '[' val ']'
-	      | min_lval '.' ID
-	      | compound_lval '[' val ']'
-	      | compound_lval '.' ID
+          : min_lval '[' val ']'
+          | min_lval '.' ID
+          | compound_lval '[' val ']'
+          | compound_lval '.' ID
 
    This is not part of the original SIMPLE definition, which separates
    array and member references, but it seems reasonable to handle them
@@ -1998,12 +1896,13 @@
 
 static enum gimplify_status
 gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
-			fallback_t fallback)
+            fallback_t fallback)
 {
   tree *p;
   VEC(tree,heap) *stack;
   enum gimplify_status ret = GS_OK, tret;
   int i;
+  location_t loc = EXPR_LOCATION (*expr_p);
 
   /* Create a stack of the subexpressions so later we can walk them in
      order from inner to outer.  */
@@ -2015,18 +1914,18 @@
     restart:
       /* Fold INDIRECT_REFs now to turn them into ARRAY_REFs.  */
       if (TREE_CODE (*p) == INDIRECT_REF)
-	*p = fold_indirect_ref (*p);
+    *p = fold_indirect_ref_loc (loc, *p);
 
       if (handled_component_p (*p))
-	;
+    ;
       /* Expand DECL_VALUE_EXPR now.  In some cases that may expose
-	 additional COMPONENT_REFs.  */
+     additional COMPONENT_REFs.  */
       else if ((TREE_CODE (*p) == VAR_DECL || TREE_CODE (*p) == PARM_DECL)
-	       && gimplify_var_or_parm_decl (p) == GS_OK)
-	goto restart;
+           && gimplify_var_or_parm_decl (p) == GS_OK)
+    goto restart;
       else
-	break;
-	       
+    break;
+
       VEC_safe_push (tree, heap, stack, *p);
     }
 
@@ -2049,73 +1948,73 @@
       tree t = VEC_index (tree, stack, i);
 
       if (TREE_CODE (t) == ARRAY_REF || TREE_CODE (t) == ARRAY_RANGE_REF)
-	{
-	  /* Gimplify the low bound and element type size and put them into
-	     the ARRAY_REF.  If these values are set, they have already been
-	     gimplified.  */
-	  if (TREE_OPERAND (t, 2) == NULL_TREE)
-	    {
-	      tree low = unshare_expr (array_ref_low_bound (t));
-	      if (!is_gimple_min_invariant (low))
-		{
-		  TREE_OPERAND (t, 2) = low;
-		  tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p,
-					post_p, is_gimple_formal_tmp_reg,
-					fb_rvalue);
-		  ret = MIN (ret, tret);
-		}
-	    }
-
-	  if (!TREE_OPERAND (t, 3))
-	    {
-	      tree elmt_type = TREE_TYPE (TREE_TYPE (TREE_OPERAND (t, 0)));
-	      tree elmt_size = unshare_expr (array_ref_element_size (t));
-	      tree factor = size_int (TYPE_ALIGN_UNIT (elmt_type));
-
-	      /* Divide the element size by the alignment of the element
-		 type (above).  */
-	      elmt_size = size_binop (EXACT_DIV_EXPR, elmt_size, factor);
-
-	      if (!is_gimple_min_invariant (elmt_size))
-		{
-		  TREE_OPERAND (t, 3) = elmt_size;
-		  tret = gimplify_expr (&TREE_OPERAND (t, 3), pre_p,
-					post_p, is_gimple_formal_tmp_reg,
-					fb_rvalue);
-		  ret = MIN (ret, tret);
-		}
-	    }
-	}
+    {
+      /* Gimplify the low bound and element type size and put them into
+         the ARRAY_REF.  If these values are set, they have already been
+         gimplified.  */
+      if (TREE_OPERAND (t, 2) == NULL_TREE)
+        {
+          tree low = unshare_expr (array_ref_low_bound (t));
+          if (!is_gimple_min_invariant (low))
+        {
+          TREE_OPERAND (t, 2) = low;
+          tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p,
+                    post_p, is_gimple_reg,
+                    fb_rvalue);
+          ret = MIN (ret, tret);
+        }
+        }
+
+      if (!TREE_OPERAND (t, 3))
+        {
+          tree elmt_type = TREE_TYPE (TREE_TYPE (TREE_OPERAND (t, 0)));
+          tree elmt_size = unshare_expr (array_ref_element_size (t));
+          tree factor = size_int (TYPE_ALIGN_UNIT (elmt_type));
+
+          /* Divide the element size by the alignment of the element
+         type (above).  */
+          elmt_size = size_binop_loc (loc, EXACT_DIV_EXPR, elmt_size, factor);
+
+          if (!is_gimple_min_invariant (elmt_size))
+        {
+          TREE_OPERAND (t, 3) = elmt_size;
+          tret = gimplify_expr (&TREE_OPERAND (t, 3), pre_p,
+                    post_p, is_gimple_reg,
+                    fb_rvalue);
+          ret = MIN (ret, tret);
+        }
+        }
+    }
       else if (TREE_CODE (t) == COMPONENT_REF)
-	{
-	  /* Set the field offset into T and gimplify it.  */
-	  if (!TREE_OPERAND (t, 2))
-	    {
-	      tree offset = unshare_expr (component_ref_field_offset (t));
-	      tree field = TREE_OPERAND (t, 1);
-	      tree factor
-		= size_int (DECL_OFFSET_ALIGN (field) / BITS_PER_UNIT);
-
-	      /* Divide the offset by its alignment.  */
-	      offset = size_binop (EXACT_DIV_EXPR, offset, factor);
-
-	      if (!is_gimple_min_invariant (offset))
-		{
-		  TREE_OPERAND (t, 2) = offset;
-		  tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p,
-					post_p, is_gimple_formal_tmp_reg,
-					fb_rvalue);
-		  ret = MIN (ret, tret);
-		}
-	    }
-	}
+    {
+      /* Set the field offset into T and gimplify it.  */
+      if (!TREE_OPERAND (t, 2))
+        {
+          tree offset = unshare_expr (component_ref_field_offset (t));
+          tree field = TREE_OPERAND (t, 1);
+          tree factor
+        = size_int (DECL_OFFSET_ALIGN (field) / BITS_PER_UNIT);
+
+          /* Divide the offset by its alignment.  */
+          offset = size_binop_loc (loc, EXACT_DIV_EXPR, offset, factor);
+
+          if (!is_gimple_min_invariant (offset))
+        {
+          TREE_OPERAND (t, 2) = offset;
+          tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p,
+                    post_p, is_gimple_reg,
+                    fb_rvalue);
+          ret = MIN (ret, tret);
+        }
+        }
+    }
     }
 
   /* Step 2 is to gimplify the base expression.  Make sure lvalue is set
      so as to match the min_lval predicate.  Failure to do so may result
      in the creation of large aggregate temporaries.  */
   tret = gimplify_expr (p, pre_p, post_p, is_gimple_min_lval,
-			fallback | fb_lvalue);
+            fallback | fb_lvalue);
   ret = MIN (ret, tret);
 
   /* And finally, the indices and operands to BIT_FIELD_REF.  During this
@@ -2125,39 +2024,31 @@
       tree t = VEC_pop (tree, stack);
 
       if (TREE_CODE (t) == ARRAY_REF || TREE_CODE (t) == ARRAY_RANGE_REF)
-	{
-	  /* Gimplify the dimension.
-	     Temporary fix for gcc.c-torture/execute/20040313-1.c.
-	     Gimplify non-constant array indices into a temporary
-	     variable.
-	     FIXME - The real fix is to gimplify post-modify
-	     expressions into a minimal gimple lvalue.  However, that
-	     exposes bugs in alias analysis.  The alias analyzer does
-	     not handle &PTR->FIELD very well.  Will fix after the
-	     branch is merged into mainline (dnovillo 2004-05-03).  */
-	  if (!is_gimple_min_invariant (TREE_OPERAND (t, 1)))
-	    {
-	      tret = gimplify_expr (&TREE_OPERAND (t, 1), pre_p, post_p,
-				    is_gimple_formal_tmp_reg, fb_rvalue);
-	      ret = MIN (ret, tret);
-	    }
-	}
+    {
+      /* Gimplify the dimension.  */
+      if (!is_gimple_min_invariant (TREE_OPERAND (t, 1)))
+        {
+          tret = gimplify_expr (&TREE_OPERAND (t, 1), pre_p, post_p,
+                    is_gimple_val, fb_rvalue);
+          ret = MIN (ret, tret);
+        }
+    }
       else if (TREE_CODE (t) == BIT_FIELD_REF)
-	{
-	  tret = gimplify_expr (&TREE_OPERAND (t, 1), pre_p, post_p,
-				is_gimple_val, fb_rvalue);
-	  ret = MIN (ret, tret);
-	  tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p, post_p,
-				is_gimple_val, fb_rvalue);
-	  ret = MIN (ret, tret);
-	}
+    {
+      tret = gimplify_expr (&TREE_OPERAND (t, 1), pre_p, post_p,
+                is_gimple_val, fb_rvalue);
+      ret = MIN (ret, tret);
+      tret = gimplify_expr (&TREE_OPERAND (t, 2), pre_p, post_p,
+                is_gimple_val, fb_rvalue);
+      ret = MIN (ret, tret);
+    }
 
       STRIP_USELESS_TYPE_CONVERSION (TREE_OPERAND (t, 0));
 
       /* The innermost expression P may have originally had
-	 TREE_SIDE_EFFECTS set which would have caused all the outer
-	 expressions in *EXPR_P leading to P to also have had
-	 TREE_SIDE_EFFECTS set.  */
+     TREE_SIDE_EFFECTS set which would have caused all the outer
+     expressions in *EXPR_P leading to P to also have had
+     TREE_SIDE_EFFECTS set.  */
       recalculate_side_effects (t);
     }
 
@@ -2177,17 +2068,17 @@
     (++, --, +=, -=).
 
     PRE_P points to the list where side effects that must happen before
-	*EXPR_P should be stored.
+    *EXPR_P should be stored.
 
     POST_P points to the list where side effects that must happen after
-	*EXPR_P should be stored.
+    *EXPR_P should be stored.
 
     WANT_VALUE is nonzero iff we want to use the value of this expression
-	in another expression.  */
+    in another expression.  */
 
 static enum gimplify_status
 gimplify_self_mod_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
-			bool want_value)
+            bool want_value)
 {
   enum tree_code code;
   tree lhs, lvalue, rhs, t1;
@@ -2195,11 +2086,12 @@
   bool postfix;
   enum tree_code arith_code;
   enum gimplify_status ret;
+  location_t loc = EXPR_LOCATION (*expr_p);
 
   code = TREE_CODE (*expr_p);
 
   gcc_assert (code == POSTINCREMENT_EXPR || code == POSTDECREMENT_EXPR
-	      || code == PREINCREMENT_EXPR || code == PREDECREMENT_EXPR);
+          || code == PREINCREMENT_EXPR || code == PREDECREMENT_EXPR);
 
   /* Prefix or postfix?  */
   if (code == POSTINCREMENT_EXPR || code == POSTDECREMENT_EXPR)
@@ -2230,20 +2122,29 @@
   rhs = TREE_OPERAND (*expr_p, 1);
 
   /* For postfix operator, we evaluate the LHS to an rvalue and then use
-     that as the result value and in the postqueue operation.  */
+     that as the result value and in the postqueue operation.  We also
+     make sure to make lvalue a minimal lval, see
+     gcc.c-torture/execute/20040313-1.c for an example where this matters.  */
   if (postfix)
     {
+      if (!is_gimple_min_lval (lvalue))
+    {
+      mark_addressable (lvalue);
+      lvalue = build_fold_addr_expr_loc (input_location, lvalue);
+      gimplify_expr (&lvalue, pre_p, post_p, is_gimple_val, fb_rvalue);
+      lvalue = build_fold_indirect_ref_loc (input_location, lvalue);
+    }
       ret = gimplify_expr (&lhs, pre_p, post_p, is_gimple_val, fb_rvalue);
       if (ret == GS_ERROR)
-	return ret;
+    return ret;
     }
 
   /* For POINTERs increment, use POINTER_PLUS_EXPR.  */
   if (POINTER_TYPE_P (TREE_TYPE (lhs)))
     {
-      rhs = fold_convert (sizetype, rhs);
+      rhs = fold_convert_loc (loc, sizetype, rhs);
       if (arith_code == MINUS_EXPR)
-	rhs = fold_build1 (NEGATE_EXPR, TREE_TYPE (rhs), rhs);
+    rhs = fold_build1_loc (loc, NEGATE_EXPR, TREE_TYPE (rhs), rhs);
       arith_code = POINTER_PLUS_EXPR;
     }
 
@@ -2314,6 +2215,7 @@
   /* If this is a variable sized type, we must remember the size.  */
   maybe_with_size_expr (arg_p);
 
+  /* FIXME diagnostics: This will mess up gcc.dg/Warray-bounds.c.  */
   /* Make sure arguments have the same location as the function call
      itself.  */
   protected_set_expr_location (*arg_p, call_location);
@@ -2337,6 +2239,7 @@
   int i, nargs;
   gimple call;
   bool builtin_va_start_p = FALSE;
+  location_t loc = EXPR_LOCATION (*expr_p);
 
   gcc_assert (TREE_CODE (*expr_p) == CALL_EXPR);
 
@@ -2360,41 +2263,41 @@
   fndecl = get_callee_fndecl (*expr_p);
   if (fndecl && DECL_BUILT_IN (fndecl))
     {
-      tree new_tree = fold_call_expr (*expr_p, !want_value);
+      tree new_tree = fold_call_expr (input_location, *expr_p, !want_value);
 
       if (new_tree && new_tree != *expr_p)
-	{
-	  /* There was a transformation of this call which computes the
-	     same value, but in a more efficient way.  Return and try
-	     again.  */
-	  *expr_p = new_tree;
-	  return GS_OK;
-	}
+    {
+      /* There was a transformation of this call which computes the
+         same value, but in a more efficient way.  Return and try
+         again.  */
+      *expr_p = new_tree;
+      return GS_OK;
+    }
 
       if (DECL_BUILT_IN_CLASS (fndecl) == BUILT_IN_NORMAL
-	  && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_VA_START)
+      && DECL_FUNCTION_CODE (fndecl) == BUILT_IN_VA_START)
+        {
+      builtin_va_start_p = TRUE;
+      if (call_expr_nargs (*expr_p) < 2)
         {
-	  builtin_va_start_p = TRUE;
-	  if (call_expr_nargs (*expr_p) < 2)
-	    {
-	      error ("too few arguments to function %<va_start%>");
-	      *expr_p = build_empty_stmt ();
-	      return GS_OK;
-	    }
-	  
-	  if (fold_builtin_next_arg (*expr_p, true))
-	    {
-	      *expr_p = build_empty_stmt ();
-	      return GS_OK;
-	    }
-	}
+          error ("too few arguments to function %<va_start%>");
+          *expr_p = build_empty_stmt (EXPR_LOCATION (*expr_p));
+          return GS_OK;
+        }
+
+      if (fold_builtin_next_arg (*expr_p, true))
+        {
+          *expr_p = build_empty_stmt (EXPR_LOCATION (*expr_p));
+          return GS_OK;
+        }
+    }
     }
 
   /* There is a sequence point before the call, so any side effects in
      the calling expression must occur before the actual call.  Force
      gimplify_expr to use an internal post queue.  */
   ret = gimplify_expr (&CALL_EXPR_FN (*expr_p), pre_p, NULL,
-		       is_gimple_call_addr, fb_rvalue);
+               is_gimple_call_addr, fb_rvalue);
 
   nargs = call_expr_nargs (*expr_p);
 
@@ -2426,30 +2329,31 @@
       tree last_arg_fndecl = get_callee_fndecl (last_arg);
 
       if (last_arg_fndecl
-	  && TREE_CODE (last_arg_fndecl) == FUNCTION_DECL
-	  && DECL_BUILT_IN_CLASS (last_arg_fndecl) == BUILT_IN_NORMAL
-	  && DECL_FUNCTION_CODE (last_arg_fndecl) == BUILT_IN_VA_ARG_PACK)
-	{
-	  tree call = *expr_p;
-
-	  --nargs;
-	  *expr_p = build_call_array (TREE_TYPE (call), CALL_EXPR_FN (call),
-				      nargs, CALL_EXPR_ARGP (call));
-
-	  /* Copy all CALL_EXPR flags, location and block, except
-	     CALL_EXPR_VA_ARG_PACK flag.  */
-	  CALL_EXPR_STATIC_CHAIN (*expr_p) = CALL_EXPR_STATIC_CHAIN (call);
-	  CALL_EXPR_TAILCALL (*expr_p) = CALL_EXPR_TAILCALL (call);
-	  CALL_EXPR_RETURN_SLOT_OPT (*expr_p)
-	    = CALL_EXPR_RETURN_SLOT_OPT (call);
-	  CALL_FROM_THUNK_P (*expr_p) = CALL_FROM_THUNK_P (call);
-	  CALL_CANNOT_INLINE_P (*expr_p) = CALL_CANNOT_INLINE_P (call);
-	  SET_EXPR_LOCUS (*expr_p, EXPR_LOCUS (call));
-	  TREE_BLOCK (*expr_p) = TREE_BLOCK (call);
-
-	  /* Set CALL_EXPR_VA_ARG_PACK.  */
-	  CALL_EXPR_VA_ARG_PACK (*expr_p) = 1;
-	}
+      && TREE_CODE (last_arg_fndecl) == FUNCTION_DECL
+      && DECL_BUILT_IN_CLASS (last_arg_fndecl) == BUILT_IN_NORMAL
+      && DECL_FUNCTION_CODE (last_arg_fndecl) == BUILT_IN_VA_ARG_PACK)
+    {
+      tree call = *expr_p;
+
+      --nargs;
+      *expr_p = build_call_array_loc (loc, TREE_TYPE (call),
+                      CALL_EXPR_FN (call),
+                      nargs, CALL_EXPR_ARGP (call));
+
+      /* Copy all CALL_EXPR flags, location and block, except
+         CALL_EXPR_VA_ARG_PACK flag.  */
+      CALL_EXPR_STATIC_CHAIN (*expr_p) = CALL_EXPR_STATIC_CHAIN (call);
+      CALL_EXPR_TAILCALL (*expr_p) = CALL_EXPR_TAILCALL (call);
+      CALL_EXPR_RETURN_SLOT_OPT (*expr_p)
+        = CALL_EXPR_RETURN_SLOT_OPT (call);
+      CALL_FROM_THUNK_P (*expr_p) = CALL_FROM_THUNK_P (call);
+      CALL_CANNOT_INLINE_P (*expr_p) = CALL_CANNOT_INLINE_P (call);
+      SET_EXPR_LOCATION (*expr_p, EXPR_LOCATION (call));
+      TREE_BLOCK (*expr_p) = TREE_BLOCK (call);
+
+      /* Set CALL_EXPR_VA_ARG_PACK.  */
+      CALL_EXPR_VA_ARG_PACK (*expr_p) = 1;
+    }
     }
 
   /* Finally, gimplify the function arguments.  */
@@ -2466,7 +2370,7 @@
           if ((i != 1) || !builtin_va_start_p)
             {
               t = gimplify_arg (&CALL_EXPR_ARG (*expr_p, i), pre_p,
-				EXPR_LOCATION (*expr_p));
+                EXPR_LOCATION (*expr_p));
 
               if (t == GS_ERROR)
                 ret = GS_ERROR;
@@ -2474,19 +2378,27 @@
         }
     }
 
+  /* Verify the function result.  */
+  if (want_value && fndecl
+      && VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fndecl))))
+    {
+      error_at (loc, "using result of function returning %<void%>");
+      ret = GS_ERROR;
+    }
+
   /* Try this again in case gimplification exposed something.  */
   if (ret != GS_ERROR)
     {
-      tree new_tree = fold_call_expr (*expr_p, !want_value);
+      tree new_tree = fold_call_expr (input_location, *expr_p, !want_value);
 
       if (new_tree && new_tree != *expr_p)
-	{
-	  /* There was a transformation of this call which computes the
-	     same value, but in a more efficient way.  Return and try
-	     again.  */
-	  *expr_p = new_tree;
-	  return GS_OK;
-	}
+    {
+      /* There was a transformation of this call which computes the
+         same value, but in a more efficient way.  Return and try
+         again.  */
+      *expr_p = new_tree;
+      return GS_OK;
+    }
     }
   else
     {
@@ -2501,9 +2413,9 @@
     {
       int flags = call_expr_flags (*expr_p);
       if (flags & (ECF_CONST | ECF_PURE)
-	  /* An infinite loop is considered a side effect.  */
-	  && !(flags & (ECF_LOOPING_CONST_OR_PURE)))
-	TREE_SIDE_EFFECTS (*expr_p) = 0;
+      /* An infinite loop is considered a side effect.  */
+      && !(flags & (ECF_LOOPING_CONST_OR_PURE)))
+    TREE_SIDE_EFFECTS (*expr_p) = 0;
     }
 
   /* If the value is not needed by the caller, emit a new GIMPLE_CALL
@@ -2517,7 +2429,7 @@
   if (!want_value)
     {
       /* The CALL_EXPR in *EXPR_P is already in GIMPLE form, so all we
-	 have to do is replicate it as a GIMPLE_CALL tuple.  */
+     have to do is replicate it as a GIMPLE_CALL tuple.  */
       call = gimple_build_call_from_tree (*expr_p);
       gimplify_seq_add_stmt (pre_p, call);
       *expr_p = NULL_TREE;
@@ -2533,12 +2445,15 @@
    condition is true or false, respectively.  If null, we should generate
    our own to skip over the evaluation of this specific expression.
 
+   LOCUS is the source location of the COND_EXPR.
+
    This function is the tree equivalent of do_jump.
 
    shortcut_cond_r should only be called by shortcut_cond_expr.  */
 
 static tree
-shortcut_cond_r (tree pred, tree *true_label_p, tree *false_label_p)
+shortcut_cond_r (tree pred, tree *true_label_p, tree *false_label_p,
+         location_t locus)
 {
   tree local_label = NULL_TREE;
   tree t, expr = NULL;
@@ -2548,58 +2463,75 @@
      shortcut_cond_expr will append the real blocks later.  */
   if (TREE_CODE (pred) == TRUTH_ANDIF_EXPR)
     {
+      location_t new_locus;
+
       /* Turn if (a && b) into
 
-	 if (a); else goto no;
-	 if (b) goto yes; else goto no;
-	 (no:) */
+     if (a); else goto no;
+     if (b) goto yes; else goto no;
+     (no:) */
 
       if (false_label_p == NULL)
-	false_label_p = &local_label;
-
-      t = shortcut_cond_r (TREE_OPERAND (pred, 0), NULL, false_label_p);
+    false_label_p = &local_label;
+
+      /* Keep the original source location on the first 'if'.  */
+      t = shortcut_cond_r (TREE_OPERAND (pred, 0), NULL, false_label_p, locus);
       append_to_statement_list (t, &expr);
 
-      t = shortcut_cond_r (TREE_OPERAND (pred, 1), true_label_p,
-			   false_label_p);
+      /* Set the source location of the && on the second 'if'.  */
+      new_locus = EXPR_HAS_LOCATION (pred) ? EXPR_LOCATION (pred) : locus;
+      t = shortcut_cond_r (TREE_OPERAND (pred, 1), true_label_p, false_label_p,
+               new_locus);
       append_to_statement_list (t, &expr);
     }
   else if (TREE_CODE (pred) == TRUTH_ORIF_EXPR)
     {
+      location_t new_locus;
+
       /* Turn if (a || b) into
 
-	 if (a) goto yes;
-	 if (b) goto yes; else goto no;
-	 (yes:) */
+     if (a) goto yes;
+     if (b) goto yes; else goto no;
+     (yes:) */
 
       if (true_label_p == NULL)
-	true_label_p = &local_label;
-
-      t = shortcut_cond_r (TREE_OPERAND (pred, 0), true_label_p, NULL);
+    true_label_p = &local_label;
+
+      /* Keep the original source location on the first 'if'.  */
+      t = shortcut_cond_r (TREE_OPERAND (pred, 0), true_label_p, NULL, locus);
       append_to_statement_list (t, &expr);
 
-      t = shortcut_cond_r (TREE_OPERAND (pred, 1), true_label_p,
-			   false_label_p);
+      /* Set the source location of the || on the second 'if'.  */
+      new_locus = EXPR_HAS_LOCATION (pred) ? EXPR_LOCATION (pred) : locus;
+      t = shortcut_cond_r (TREE_OPERAND (pred, 1), true_label_p, false_label_p,
+               new_locus);
       append_to_statement_list (t, &expr);
     }
   else if (TREE_CODE (pred) == COND_EXPR)
     {
+      location_t new_locus;
+
       /* As long as we're messing with gotos, turn if (a ? b : c) into
-	 if (a)
-	   if (b) goto yes; else goto no;
-	 else
-	   if (c) goto yes; else goto no;  */
+     if (a)
+       if (b) goto yes; else goto no;
+     else
+       if (c) goto yes; else goto no;  */
+
+      /* Keep the original source location on the first 'if'.  Set the source
+     location of the ? on the second 'if'.  */
+      new_locus = EXPR_HAS_LOCATION (pred) ? EXPR_LOCATION (pred) : locus;
       expr = build3 (COND_EXPR, void_type_node, TREE_OPERAND (pred, 0),
-		     shortcut_cond_r (TREE_OPERAND (pred, 1), true_label_p,
-				      false_label_p),
-		     shortcut_cond_r (TREE_OPERAND (pred, 2), true_label_p,
-				      false_label_p));
+             shortcut_cond_r (TREE_OPERAND (pred, 1), true_label_p,
+                      false_label_p, locus),
+             shortcut_cond_r (TREE_OPERAND (pred, 2), true_label_p,
+                      false_label_p, new_locus));
     }
   else
     {
       expr = build3 (COND_EXPR, void_type_node, pred,
-		     build_and_jump (true_label_p),
-		     build_and_jump (false_label_p));
+             build_and_jump (true_label_p),
+             build_and_jump (false_label_p));
+      SET_EXPR_LOCATION (expr, locus);
     }
 
   if (local_label)
@@ -2631,31 +2563,48 @@
   /* First do simple transformations.  */
   if (!else_se)
     {
-      /* If there is no 'else', turn (a && b) into if (a) if (b).  */
+      /* If there is no 'else', turn
+       if (a && b) then c
+     into
+       if (a) if (b) then c.  */
       while (TREE_CODE (pred) == TRUTH_ANDIF_EXPR)
-	{
-	  TREE_OPERAND (expr, 0) = TREE_OPERAND (pred, 1);
-	  then_ = shortcut_cond_expr (expr);
-	  then_se = then_ && TREE_SIDE_EFFECTS (then_);
-	  pred = TREE_OPERAND (pred, 0);
-	  expr = build3 (COND_EXPR, void_type_node, pred, then_, NULL_TREE);
-	}
+    {
+      /* Keep the original source location on the first 'if'.  */
+      location_t locus = EXPR_HAS_LOCATION (expr)
+                 ? EXPR_LOCATION (expr) : input_location;
+      TREE_OPERAND (expr, 0) = TREE_OPERAND (pred, 1);
+      /* Set the source location of the && on the second 'if'.  */
+      if (EXPR_HAS_LOCATION (pred))
+        SET_EXPR_LOCATION (expr, EXPR_LOCATION (pred));
+      then_ = shortcut_cond_expr (expr);
+      then_se = then_ && TREE_SIDE_EFFECTS (then_);
+      pred = TREE_OPERAND (pred, 0);
+      expr = build3 (COND_EXPR, void_type_node, pred, then_, NULL_TREE);
+      SET_EXPR_LOCATION (expr, locus);
+    }
     }
 
   if (!then_se)
     {
       /* If there is no 'then', turn
-	   if (a || b); else d
-	 into
-	   if (a); else if (b); else d.  */
+       if (a || b); else d
+     into
+       if (a); else if (b); else d.  */
       while (TREE_CODE (pred) == TRUTH_ORIF_EXPR)
-	{
-	  TREE_OPERAND (expr, 0) = TREE_OPERAND (pred, 1);
-	  else_ = shortcut_cond_expr (expr);
-	  else_se = else_ && TREE_SIDE_EFFECTS (else_);
-	  pred = TREE_OPERAND (pred, 0);
-	  expr = build3 (COND_EXPR, void_type_node, pred, NULL_TREE, else_);
-	}
+    {
+      /* Keep the original source location on the first 'if'.  */
+      location_t locus = EXPR_HAS_LOCATION (expr)
+                 ? EXPR_LOCATION (expr) : input_location;
+      TREE_OPERAND (expr, 0) = TREE_OPERAND (pred, 1);
+      /* Set the source location of the || on the second 'if'.  */
+      if (EXPR_HAS_LOCATION (pred))
+        SET_EXPR_LOCATION (expr, EXPR_LOCATION (pred));
+      else_ = shortcut_cond_expr (expr);
+      else_se = else_ && TREE_SIDE_EFFECTS (else_);
+      pred = TREE_OPERAND (pred, 0);
+      expr = build3 (COND_EXPR, void_type_node, pred, NULL_TREE, else_);
+      SET_EXPR_LOCATION (expr, locus);
+    }
     }
 
   /* If we're done, great.  */
@@ -2708,17 +2657,19 @@
 
   /* If there was nothing else in our arms, just forward the label(s).  */
   if (!then_se && !else_se)
-    return shortcut_cond_r (pred, true_label_p, false_label_p);
+    return shortcut_cond_r (pred, true_label_p, false_label_p,
+                EXPR_HAS_LOCATION (expr)
+                ? EXPR_LOCATION (expr) : input_location);
 
   /* If our last subexpression already has a terminal label, reuse it.  */
   if (else_se)
-    expr = expr_last (else_);
+    t = expr_last (else_);
   else if (then_se)
-    expr = expr_last (then_);
+    t = expr_last (then_);
   else
-    expr = NULL;
-  if (expr && TREE_CODE (expr) == LABEL_EXPR)
-    end_label = LABEL_EXPR_LABEL (expr);
+    t = NULL;
+  if (t && TREE_CODE (t) == LABEL_EXPR)
+    end_label = LABEL_EXPR_LABEL (t);
 
   /* If we don't care about jumping to the 'else' branch, jump to the end
      if the condition is false.  */
@@ -2739,7 +2690,9 @@
      non-void function.  */
   jump_over_else = block_may_fallthru (then_);
 
-  pred = shortcut_cond_r (pred, true_label_p, false_label_p);
+  pred = shortcut_cond_r (pred, true_label_p, false_label_p,
+              EXPR_HAS_LOCATION (expr)
+              ? EXPR_LOCATION (expr) : input_location);
 
   expr = NULL;
   append_to_statement_list (pred, &expr);
@@ -2748,15 +2701,18 @@
   if (else_se)
     {
       if (jump_over_else)
-	{
-	  t = build_and_jump (&end_label);
-	  append_to_statement_list (t, &expr);
-	}
+    {
+      tree last = expr_last (expr);
+      t = build_and_jump (&end_label);
+      if (EXPR_HAS_LOCATION (last))
+        SET_EXPR_LOCATION (t, EXPR_LOCATION (last));
+      append_to_statement_list (t, &expr);
+    }
       if (emit_false)
-	{
-	  t = build1 (LABEL_EXPR, void_type_node, false_label);
-	  append_to_statement_list (t, &expr);
-	}
+    {
+      t = build1 (LABEL_EXPR, void_type_node, false_label);
+      append_to_statement_list (t, &expr);
+    }
       append_to_statement_list (else_, &expr);
     }
   if (emit_end && end_label)
@@ -2774,6 +2730,7 @@
 gimple_boolify (tree expr)
 {
   tree type = TREE_TYPE (expr);
+  location_t loc = EXPR_LOCATION (expr);
 
   if (TREE_CODE (type) == BOOLEAN_TYPE)
     return expr;
@@ -2801,8 +2758,8 @@
 
     default:
       /* Other expressions that get here must have boolean values, but
-	 might need to be converted to the appropriate mode.  */
-      return fold_convert (boolean_type_node, expr);
+     might need to be converted to the appropriate mode.  */
+      return fold_convert_loc (loc, boolean_type_node, expr);
     }
 }
 
@@ -2829,10 +2786,10 @@
   COND_EXPR_COND (*expr_p) = cond;
 
   tret = gimplify_expr (&COND_EXPR_THEN (expr), pre_p, NULL,
-				   is_gimple_val, fb_rvalue);
+                   is_gimple_val, fb_rvalue);
   ret = MIN (ret, tret);
   tret = gimplify_expr (&COND_EXPR_ELSE (expr), pre_p, NULL,
-				   is_gimple_val, fb_rvalue);
+                   is_gimple_val, fb_rvalue);
 
   return MIN (ret, tret);
 }
@@ -2863,10 +2820,10 @@
 /*  Convert the conditional expression pointed to by EXPR_P '(p) ? a : b;'
     into
 
-    if (p)			if (p)
-      t1 = a;			  a;
-    else		or	else
-      t1 = b;			  b;
+    if (p)          if (p)
+      t1 = a;             a;
+    else        or  else
+      t1 = b;             b;
     t1;
 
     The second form is used when *EXPR_P is of type void.
@@ -2885,6 +2842,7 @@
   gimple gimple_cond;
   enum tree_code pred_code;
   gimple_seq seq = NULL;
+  location_t loc = EXPR_LOCATION (*expr_p);
 
   type = TREE_TYPE (expr);
 
@@ -2895,53 +2853,53 @@
       tree result;
 
       /* If an rvalue is ok or we do not require an lvalue, avoid creating
-	 an addressable temporary.  */
+     an addressable temporary.  */
       if (((fallback & fb_rvalue)
-	   || !(fallback & fb_lvalue))
-	  && !TREE_ADDRESSABLE (type))
-	{
-	  if (gimplify_ctxp->allow_rhs_cond_expr
-	      /* If either branch has side effects or could trap, it can't be
-		 evaluated unconditionally.  */
-	      && !TREE_SIDE_EFFECTS (TREE_OPERAND (*expr_p, 1))
-	      && !generic_expr_could_trap_p (TREE_OPERAND (*expr_p, 1))
-	      && !TREE_SIDE_EFFECTS (TREE_OPERAND (*expr_p, 2))
-	      && !generic_expr_could_trap_p (TREE_OPERAND (*expr_p, 2)))
-	    return gimplify_pure_cond_expr (expr_p, pre_p);
-
-	  result = tmp = create_tmp_var (TREE_TYPE (expr), "iftmp");
-	  ret = GS_ALL_DONE;
-	}
+       || !(fallback & fb_lvalue))
+      && !TREE_ADDRESSABLE (type))
+    {
+      if (gimplify_ctxp->allow_rhs_cond_expr
+          /* If either branch has side effects or could trap, it can't be
+         evaluated unconditionally.  */
+          && !TREE_SIDE_EFFECTS (TREE_OPERAND (*expr_p, 1))
+          && !generic_expr_could_trap_p (TREE_OPERAND (*expr_p, 1))
+          && !TREE_SIDE_EFFECTS (TREE_OPERAND (*expr_p, 2))
+          && !generic_expr_could_trap_p (TREE_OPERAND (*expr_p, 2)))
+        return gimplify_pure_cond_expr (expr_p, pre_p);
+
+      result = tmp = create_tmp_var (TREE_TYPE (expr), "iftmp");
+      ret = GS_ALL_DONE;
+    }
       else
-	{
-	  tree type = build_pointer_type (TREE_TYPE (expr));
-
-	  if (TREE_TYPE (TREE_OPERAND (expr, 1)) != void_type_node)
-	    TREE_OPERAND (expr, 1) =
-	      build_fold_addr_expr (TREE_OPERAND (expr, 1));
-
-	  if (TREE_TYPE (TREE_OPERAND (expr, 2)) != void_type_node)
-	    TREE_OPERAND (expr, 2) =
-	      build_fold_addr_expr (TREE_OPERAND (expr, 2));
-
-	  tmp = create_tmp_var (type, "iftmp");
-
-	  expr = build3 (COND_EXPR, void_type_node, TREE_OPERAND (expr, 0),
-			 TREE_OPERAND (expr, 1), TREE_OPERAND (expr, 2));
-
-	  result = build_fold_indirect_ref (tmp);
-	}
+    {
+      tree type = build_pointer_type (TREE_TYPE (expr));
+
+      if (TREE_TYPE (TREE_OPERAND (expr, 1)) != void_type_node)
+        TREE_OPERAND (expr, 1) =
+          build_fold_addr_expr_loc (loc, TREE_OPERAND (expr, 1));
+
+      if (TREE_TYPE (TREE_OPERAND (expr, 2)) != void_type_node)
+        TREE_OPERAND (expr, 2) =
+          build_fold_addr_expr_loc (loc, TREE_OPERAND (expr, 2));
+
+      tmp = create_tmp_var (type, "iftmp");
+
+      expr = build3 (COND_EXPR, void_type_node, TREE_OPERAND (expr, 0),
+             TREE_OPERAND (expr, 1), TREE_OPERAND (expr, 2));
+
+      result = build_fold_indirect_ref_loc (loc, tmp);
+    }
 
       /* Build the then clause, 't1 = a;'.  But don't build an assignment
-	 if this branch is void; in C++ it can be, if it's a throw.  */
+     if this branch is void; in C++ it can be, if it's a throw.  */
       if (TREE_TYPE (TREE_OPERAND (expr, 1)) != void_type_node)
-	TREE_OPERAND (expr, 1)
-	  = build2 (MODIFY_EXPR, TREE_TYPE (tmp), tmp, TREE_OPERAND (expr, 1));
+    TREE_OPERAND (expr, 1)
+      = build2 (MODIFY_EXPR, TREE_TYPE (tmp), tmp, TREE_OPERAND (expr, 1));
 
       /* Build the else clause, 't1 = b;'.  */
       if (TREE_TYPE (TREE_OPERAND (expr, 2)) != void_type_node)
-	TREE_OPERAND (expr, 2)
-	  = build2 (MODIFY_EXPR, TREE_TYPE (tmp), tmp, TREE_OPERAND (expr, 2));
+    TREE_OPERAND (expr, 2)
+      = build2 (MODIFY_EXPR, TREE_TYPE (tmp), tmp, TREE_OPERAND (expr, 2));
 
       TREE_TYPE (expr) = void_type_node;
       recalculate_side_effects (expr);
@@ -2963,27 +2921,27 @@
       expr = shortcut_cond_expr (expr);
 
       if (expr != *expr_p)
-	{
-	  *expr_p = expr;
-
-	  /* We can't rely on gimplify_expr to re-gimplify the expanded
-	     form properly, as cleanups might cause the target labels to be
-	     wrapped in a TRY_FINALLY_EXPR.  To prevent that, we need to
-	     set up a conditional context.  */
-	  gimple_push_condition ();
-	  gimplify_stmt (expr_p, &seq);
-	  gimple_pop_condition (pre_p);
-	  gimple_seq_add_seq (pre_p, seq);
-
-	  return GS_ALL_DONE;
-	}
+    {
+      *expr_p = expr;
+
+      /* We can't rely on gimplify_expr to re-gimplify the expanded
+         form properly, as cleanups might cause the target labels to be
+         wrapped in a TRY_FINALLY_EXPR.  To prevent that, we need to
+         set up a conditional context.  */
+      gimple_push_condition ();
+      gimplify_stmt (expr_p, &seq);
+      gimple_pop_condition (pre_p);
+      gimple_seq_add_seq (pre_p, seq);
+
+      return GS_ALL_DONE;
+    }
     }
 
   /* Now do the normal gimplification.  */
 
   /* Gimplify condition.  */
   ret = gimplify_expr (&TREE_OPERAND (expr, 0), pre_p, NULL, is_gimple_condexpr,
-		       fb_rvalue);
+               fb_rvalue);
   if (ret == GS_ERROR)
     return GS_ERROR;
   gcc_assert (TREE_OPERAND (expr, 0) != NULL_TREE);
@@ -2995,41 +2953,41 @@
       && TREE_CODE (TREE_OPERAND (expr, 1)) == GOTO_EXPR
       && TREE_CODE (GOTO_DESTINATION (TREE_OPERAND (expr, 1))) == LABEL_DECL
       && (DECL_CONTEXT (GOTO_DESTINATION (TREE_OPERAND (expr, 1)))
-	  == current_function_decl)
+      == current_function_decl)
       /* For -O0 avoid this optimization if the COND_EXPR and GOTO_EXPR
-	 have different locations, otherwise we end up with incorrect
-	 location information on the branches.  */
+     have different locations, otherwise we end up with incorrect
+     location information on the branches.  */
       && (optimize
-	  || !EXPR_HAS_LOCATION (expr)
-	  || !EXPR_HAS_LOCATION (TREE_OPERAND (expr, 1))
-	  || EXPR_LOCATION (expr) == EXPR_LOCATION (TREE_OPERAND (expr, 1))))
+      || !EXPR_HAS_LOCATION (expr)
+      || !EXPR_HAS_LOCATION (TREE_OPERAND (expr, 1))
+      || EXPR_LOCATION (expr) == EXPR_LOCATION (TREE_OPERAND (expr, 1))))
     {
       label_true = GOTO_DESTINATION (TREE_OPERAND (expr, 1));
       have_then_clause_p = true;
     }
   else
-    label_true = create_artificial_label ();
+    label_true = create_artificial_label (UNKNOWN_LOCATION);
   if (TREE_OPERAND (expr, 2) != NULL
       && TREE_CODE (TREE_OPERAND (expr, 2)) == GOTO_EXPR
       && TREE_CODE (GOTO_DESTINATION (TREE_OPERAND (expr, 2))) == LABEL_DECL
       && (DECL_CONTEXT (GOTO_DESTINATION (TREE_OPERAND (expr, 2)))
-	  == current_function_decl)
+      == current_function_decl)
       /* For -O0 avoid this optimization if the COND_EXPR and GOTO_EXPR
-	 have different locations, otherwise we end up with incorrect
-	 location information on the branches.  */
+     have different locations, otherwise we end up with incorrect
+     location information on the branches.  */
       && (optimize
-	  || !EXPR_HAS_LOCATION (expr)
-	  || !EXPR_HAS_LOCATION (TREE_OPERAND (expr, 2))
-	  || EXPR_LOCATION (expr) == EXPR_LOCATION (TREE_OPERAND (expr, 2))))
+      || !EXPR_HAS_LOCATION (expr)
+      || !EXPR_HAS_LOCATION (TREE_OPERAND (expr, 2))
+      || EXPR_LOCATION (expr) == EXPR_LOCATION (TREE_OPERAND (expr, 2))))
     {
       label_false = GOTO_DESTINATION (TREE_OPERAND (expr, 2));
       have_else_clause_p = true;
     }
   else
-    label_false = create_artificial_label ();
+    label_false = create_artificial_label (UNKNOWN_LOCATION);
 
   gimple_cond_get_ops_from_tree (COND_EXPR_COND (expr), &pred_code, &arm1,
-				 &arm2);
+                 &arm2);
 
   gimple_cond = gimple_build_cond (pred_code, arm1, arm2, label_true,
                                    label_false);
@@ -3039,39 +2997,39 @@
   if (!have_then_clause_p)
     {
       /* For if (...) {} else { code; } put label_true after
-	 the else block.  */
+     the else block.  */
       if (TREE_OPERAND (expr, 1) == NULL_TREE
-	  && !have_else_clause_p
-	  && TREE_OPERAND (expr, 2) != NULL_TREE)
-	label_cont = label_true;
+      && !have_else_clause_p
+      && TREE_OPERAND (expr, 2) != NULL_TREE)
+    label_cont = label_true;
       else
-	{
-	  gimplify_seq_add_stmt (&seq, gimple_build_label (label_true));
-	  have_then_clause_p = gimplify_stmt (&TREE_OPERAND (expr, 1), &seq);
-	  /* For if (...) { code; } else {} or
-	     if (...) { code; } else goto label; or
-	     if (...) { code; return; } else { ... }
-	     label_cont isn't needed.  */
-	  if (!have_else_clause_p
-	      && TREE_OPERAND (expr, 2) != NULL_TREE
-	      && gimple_seq_may_fallthru (seq))
-	    {
-	      gimple g;
-	      label_cont = create_artificial_label ();
-
-	      g = gimple_build_goto (label_cont);
-
-	      /* GIMPLE_COND's are very low level; they have embedded
-		 gotos.  This particular embedded goto should not be marked
-		 with the location of the original COND_EXPR, as it would
-		 correspond to the COND_EXPR's condition, not the ELSE or the
-		 THEN arms.  To avoid marking it with the wrong location, flag
-		 it as "no location".  */
-	      gimple_set_do_not_emit_location (g);
-
-	      gimplify_seq_add_stmt (&seq, g);
-	    }
-	}
+    {
+      gimplify_seq_add_stmt (&seq, gimple_build_label (label_true));
+      have_then_clause_p = gimplify_stmt (&TREE_OPERAND (expr, 1), &seq);
+      /* For if (...) { code; } else {} or
+         if (...) { code; } else goto label; or
+         if (...) { code; return; } else { ... }
+         label_cont isn't needed.  */
+      if (!have_else_clause_p
+          && TREE_OPERAND (expr, 2) != NULL_TREE
+          && gimple_seq_may_fallthru (seq))
+        {
+          gimple g;
+          label_cont = create_artificial_label (UNKNOWN_LOCATION);
+
+          g = gimple_build_goto (label_cont);
+
+          /* GIMPLE_COND's are very low level; they have embedded
+         gotos.  This particular embedded goto should not be marked
+         with the location of the original COND_EXPR, as it would
+         correspond to the COND_EXPR's condition, not the ELSE or the
+         THEN arms.  To avoid marking it with the wrong location, flag
+         it as "no location".  */
+          gimple_set_do_not_emit_location (g);
+
+          gimplify_seq_add_stmt (&seq, g);
+        }
+    }
     }
   if (!have_else_clause_p)
     {
@@ -3099,24 +3057,50 @@
   return ret;
 }
 
+/* Prepare the node pointed to by EXPR_P, an is_gimple_addressable expression,
+   to be marked addressable.
+
+   We cannot rely on such an expression being directly markable if a temporary
+   has been created by the gimplification.  In this case, we create another
+   temporary and initialize it with a copy, which will become a store after we
+   mark it addressable.  This can happen if the front-end passed us something
+   that it could not mark addressable yet, like a Fortran pass-by-reference
+   parameter (int) floatvar.  */
+
+static void
+prepare_gimple_addressable (tree *expr_p, gimple_seq *seq_p)
+{
+  while (handled_component_p (*expr_p))
+    expr_p = &TREE_OPERAND (*expr_p, 0);
+  if (is_gimple_reg (*expr_p))
+    *expr_p = get_initialized_tmp_var (*expr_p, seq_p, NULL);
+}
+
 /* A subroutine of gimplify_modify_expr.  Replace a MODIFY_EXPR with
    a call to __builtin_memcpy.  */
 
 static enum gimplify_status
 gimplify_modify_expr_to_memcpy (tree *expr_p, tree size, bool want_value,
-    				gimple_seq *seq_p)
+                    gimple_seq *seq_p)
 {
   tree t, to, to_ptr, from, from_ptr;
   gimple gs;
+  location_t loc = EXPR_LOCATION (*expr_p);
 
   to = TREE_OPERAND (*expr_p, 0);
   from = TREE_OPERAND (*expr_p, 1);
 
-  from_ptr = build_fold_addr_expr (from);
-  gimplify_arg (&from_ptr, seq_p, EXPR_LOCATION (*expr_p));
-
-  to_ptr = build_fold_addr_expr (to);
-  gimplify_arg (&to_ptr, seq_p, EXPR_LOCATION (*expr_p));
+  /* Mark the RHS addressable.  Beware that it may not be possible to do so
+     directly if a temporary has been created by the gimplification.  */
+  prepare_gimple_addressable (&from, seq_p);
+
+  mark_addressable (from);
+  from_ptr = build_fold_addr_expr_loc (loc, from);
+  gimplify_arg (&from_ptr, seq_p, loc);
+
+  mark_addressable (to);
+  to_ptr = build_fold_addr_expr_loc (loc, to);
+  gimplify_arg (&to_ptr, seq_p, loc);
 
   t = implicit_built_in_decls[BUILT_IN_MEMCPY];
 
@@ -3144,26 +3128,27 @@
 
 static enum gimplify_status
 gimplify_modify_expr_to_memset (tree *expr_p, tree size, bool want_value,
-    				gimple_seq *seq_p)
+                    gimple_seq *seq_p)
 {
   tree t, from, to, to_ptr;
   gimple gs;
+  location_t loc = EXPR_LOCATION (*expr_p);
 
   /* Assert our assumptions, to abort instead of producing wrong code
      silently if they are not met.  Beware that the RHS CONSTRUCTOR might
      not be immediately exposed.  */
-  from = TREE_OPERAND (*expr_p, 1);  
+  from = TREE_OPERAND (*expr_p, 1);
   if (TREE_CODE (from) == WITH_SIZE_EXPR)
     from = TREE_OPERAND (from, 0);
 
   gcc_assert (TREE_CODE (from) == CONSTRUCTOR
-	      && VEC_empty (constructor_elt, CONSTRUCTOR_ELTS (from)));
+          && VEC_empty (constructor_elt, CONSTRUCTOR_ELTS (from)));
 
   /* Now proceed.  */
   to = TREE_OPERAND (*expr_p, 0);
 
-  to_ptr = build_fold_addr_expr (to);
-  gimplify_arg (&to_ptr, seq_p, EXPR_LOCATION (*expr_p));
+  to_ptr = build_fold_addr_expr_loc (loc, to);
+  gimplify_arg (&to_ptr, seq_p, loc);
   t = implicit_built_in_decls[BUILT_IN_MEMSET];
 
   gs = gimple_build_call (t, 3, to_ptr, integer_zero_node, size);
@@ -3224,12 +3209,12 @@
       tree type, fntype = TREE_TYPE (TREE_TYPE (CALL_EXPR_FN (t)));
 
       for (type = TYPE_ARG_TYPES (fntype); type; type = TREE_CHAIN (type))
-	if (POINTER_TYPE_P (TREE_VALUE (type))
-	    && (!data->lhs_base_decl || TREE_ADDRESSABLE (data->lhs_base_decl))
-	    && alias_sets_conflict_p (data->lhs_alias_set,
-				      get_alias_set
-				        (TREE_TYPE (TREE_VALUE (type)))))
-	  return t;
+    if (POINTER_TYPE_P (TREE_VALUE (type))
+        && (!data->lhs_base_decl || TREE_ADDRESSABLE (data->lhs_base_decl))
+        && alias_sets_conflict_p (data->lhs_alias_set,
+                      get_alias_set
+                        (TREE_TYPE (TREE_VALUE (type)))))
+      return t;
     }
 
   if (IS_TYPE_OR_DECL_P (t))
@@ -3243,7 +3228,7 @@
 
 static void
 gimplify_init_ctor_preeval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
-			    struct gimplify_init_ctor_preeval_data *data)
+                struct gimplify_init_ctor_preeval_data *data)
 {
   enum gimplify_status one;
 
@@ -3251,7 +3236,7 @@
   if (TREE_CONSTANT (*expr_p))
     {
       /* Ensure it does not have side effects, it might contain a reference to
-	 the object we're initializing.  */
+     the object we're initializing.  */
       gcc_assert (!TREE_SIDE_EFFECTS (*expr_p));
       return;
     }
@@ -3268,7 +3253,7 @@
       VEC(constructor_elt,gc) *v = CONSTRUCTOR_ELTS (*expr_p);
 
       for (ix = 0; VEC_iterate (constructor_elt, v, ix, ce); ix++)
-	gimplify_init_ctor_preeval (&ce->value, pre_p, post_p, data);
+    gimplify_init_ctor_preeval (&ce->value, pre_p, post_p, data);
 
       return;
     }
@@ -3316,7 +3301,7 @@
     loop_entry:
       object[var] = value;
       if (var == upper)
-	goto loop_exit;
+    goto loop_exit;
       var = var + 1;
       goto loop_entry;
     loop_exit:
@@ -3328,19 +3313,19 @@
    already been taken care of for us, in gimplify_init_ctor_preeval().  */
 
 static void gimplify_init_ctor_eval (tree, VEC(constructor_elt,gc) *,
-				     gimple_seq *, bool);
+                     gimple_seq *, bool);
 
 static void
 gimplify_init_ctor_eval_range (tree object, tree lower, tree upper,
-			       tree value, tree array_elt_type,
-			       gimple_seq *pre_p, bool cleared)
+                   tree value, tree array_elt_type,
+                   gimple_seq *pre_p, bool cleared)
 {
   tree loop_entry_label, loop_exit_label, fall_thru_label;
   tree var, var_type, cref, tmp;
 
-  loop_entry_label = create_artificial_label ();
-  loop_exit_label = create_artificial_label ();
-  fall_thru_label = create_artificial_label ();
+  loop_entry_label = create_artificial_label (UNKNOWN_LOCATION);
+  loop_exit_label = create_artificial_label (UNKNOWN_LOCATION);
+  fall_thru_label = create_artificial_label (UNKNOWN_LOCATION);
 
   /* Create and initialize the index variable.  */
   var_type = TREE_TYPE (upper);
@@ -3352,7 +3337,7 @@
 
   /* Build the reference.  */
   cref = build4 (ARRAY_REF, array_elt_type, unshare_expr (object),
-		 var, NULL_TREE, NULL_TREE);
+         var, NULL_TREE, NULL_TREE);
 
   /* If we are a constructor, just call gimplify_init_ctor_eval to do
      the store.  Otherwise just assign value to the reference.  */
@@ -3361,20 +3346,20 @@
     /* NB we might have to call ourself recursively through
        gimplify_init_ctor_eval if the value is a constructor.  */
     gimplify_init_ctor_eval (cref, CONSTRUCTOR_ELTS (value),
-			     pre_p, cleared);
+                 pre_p, cleared);
   else
     gimplify_seq_add_stmt (pre_p, gimple_build_assign (cref, value));
 
   /* We exit the loop when the index var is equal to the upper bound.  */
   gimplify_seq_add_stmt (pre_p,
-			 gimple_build_cond (EQ_EXPR, var, upper,
-					    loop_exit_label, fall_thru_label));
+             gimple_build_cond (EQ_EXPR, var, upper,
+                        loop_exit_label, fall_thru_label));
 
   gimplify_seq_add_stmt (pre_p, gimple_build_label (fall_thru_label));
 
   /* Otherwise, increment the index var...  */
   tmp = build2 (PLUS_EXPR, var_type, var,
-		fold_convert (var_type, integer_one_node));
+        fold_convert (var_type, integer_one_node));
   gimplify_seq_add_stmt (pre_p, gimple_build_assign (var, tmp));
 
   /* ...and jump back to the loop entry.  */
@@ -3385,18 +3370,18 @@
 }
 
 /* Return true if FDECL is accessing a field that is zero sized.  */
-   
+
 static bool
 zero_sized_field_decl (const_tree fdecl)
 {
-  if (TREE_CODE (fdecl) == FIELD_DECL && DECL_SIZE (fdecl) 
+  if (TREE_CODE (fdecl) == FIELD_DECL && DECL_SIZE (fdecl)
       && integer_zerop (DECL_SIZE (fdecl)))
     return true;
   return false;
 }
 
 /* Return true if TYPE is zero sized.  */
-   
+
 static bool
 zero_sized_type (const_tree type)
 {
@@ -3414,7 +3399,7 @@
 
 static void
 gimplify_init_ctor_eval (tree object, VEC(constructor_elt,gc) *elts,
-			 gimple_seq *pre_p, bool cleared)
+             gimple_seq *pre_p, bool cleared)
 {
   tree array_elt_type = NULL;
   unsigned HOST_WIDE_INT ix;
@@ -3429,68 +3414,68 @@
 
       /* NULL values are created above for gimplification errors.  */
       if (value == NULL)
-	continue;
+    continue;
 
       if (cleared && initializer_zerop (value))
-	continue;
+    continue;
 
       /* ??? Here's to hoping the front end fills in all of the indices,
-	 so we don't have to figure out what's missing ourselves.  */
+     so we don't have to figure out what's missing ourselves.  */
       gcc_assert (purpose);
 
       /* Skip zero-sized fields, unless value has side-effects.  This can
-	 happen with calls to functions returning a zero-sized type, which
-	 we shouldn't discard.  As a number of downstream passes don't
-	 expect sets of zero-sized fields, we rely on the gimplification of
-	 the MODIFY_EXPR we make below to drop the assignment statement.  */
+     happen with calls to functions returning a zero-sized type, which
+     we shouldn't discard.  As a number of downstream passes don't
+     expect sets of zero-sized fields, we rely on the gimplification of
+     the MODIFY_EXPR we make below to drop the assignment statement.  */
       if (! TREE_SIDE_EFFECTS (value) && zero_sized_field_decl (purpose))
-	continue;
+    continue;
 
       /* If we have a RANGE_EXPR, we have to build a loop to assign the
-	 whole range.  */
+     whole range.  */
       if (TREE_CODE (purpose) == RANGE_EXPR)
-	{
-	  tree lower = TREE_OPERAND (purpose, 0);
-	  tree upper = TREE_OPERAND (purpose, 1);
-
-	  /* If the lower bound is equal to upper, just treat it as if
-	     upper was the index.  */
-	  if (simple_cst_equal (lower, upper))
-	    purpose = upper;
-	  else
-	    {
-	      gimplify_init_ctor_eval_range (object, lower, upper, value,
-					     array_elt_type, pre_p, cleared);
-	      continue;
-	    }
-	}
+    {
+      tree lower = TREE_OPERAND (purpose, 0);
+      tree upper = TREE_OPERAND (purpose, 1);
+
+      /* If the lower bound is equal to upper, just treat it as if
+         upper was the index.  */
+      if (simple_cst_equal (lower, upper))
+        purpose = upper;
+      else
+        {
+          gimplify_init_ctor_eval_range (object, lower, upper, value,
+                         array_elt_type, pre_p, cleared);
+          continue;
+        }
+    }
 
       if (array_elt_type)
-	{
-	  /* Do not use bitsizetype for ARRAY_REF indices.  */
-	  if (TYPE_DOMAIN (TREE_TYPE (object)))
-	    purpose = fold_convert (TREE_TYPE (TYPE_DOMAIN (TREE_TYPE (object))),
-				    purpose);
-	  cref = build4 (ARRAY_REF, array_elt_type, unshare_expr (object),
-			 purpose, NULL_TREE, NULL_TREE);
-	}
+    {
+      /* Do not use bitsizetype for ARRAY_REF indices.  */
+      if (TYPE_DOMAIN (TREE_TYPE (object)))
+        purpose = fold_convert (TREE_TYPE (TYPE_DOMAIN (TREE_TYPE (object))),
+                    purpose);
+      cref = build4 (ARRAY_REF, array_elt_type, unshare_expr (object),
+             purpose, NULL_TREE, NULL_TREE);
+    }
       else
-	{
-	  gcc_assert (TREE_CODE (purpose) == FIELD_DECL);
-	  cref = build3 (COMPONENT_REF, TREE_TYPE (purpose),
-			 unshare_expr (object), purpose, NULL_TREE);
-	}
+    {
+      gcc_assert (TREE_CODE (purpose) == FIELD_DECL);
+      cref = build3 (COMPONENT_REF, TREE_TYPE (purpose),
+             unshare_expr (object), purpose, NULL_TREE);
+    }
 
       if (TREE_CODE (value) == CONSTRUCTOR
-	  && TREE_CODE (TREE_TYPE (value)) != VECTOR_TYPE)
-	gimplify_init_ctor_eval (cref, CONSTRUCTOR_ELTS (value),
-				 pre_p, cleared);
+      && TREE_CODE (TREE_TYPE (value)) != VECTOR_TYPE)
+    gimplify_init_ctor_eval (cref, CONSTRUCTOR_ELTS (value),
+                 pre_p, cleared);
       else
-	{
-	  tree init = build2 (INIT_EXPR, TREE_TYPE (cref), cref, value);
-	  gimplify_and_add (init, pre_p);
-	  ggc_free (init);
-	}
+    {
+      tree init = build2 (INIT_EXPR, TREE_TYPE (cref), cref, value);
+      gimplify_and_add (init, pre_p);
+      ggc_free (init);
+    }
     }
 }
 
@@ -3500,13 +3485,88 @@
 gimple_predicate
 rhs_predicate_for (tree lhs)
 {
-  if (is_gimple_formal_tmp_var (lhs))
-    return is_gimple_formal_tmp_or_call_rhs;
-  else if (is_gimple_reg (lhs))
-    return is_gimple_reg_or_call_rhs;
+  if (is_gimple_reg (lhs))
+    return is_gimple_reg_rhs_or_call;
   else
-    return is_gimple_mem_or_call_rhs;
-}
+    return is_gimple_mem_rhs_or_call;
+}
+
+/* Gimplify a C99 compound literal expression.  This just means adding
+   the DECL_EXPR before the current statement and using its anonymous
+   decl instead.  */
+
+static enum gimplify_status
+gimplify_compound_literal_expr (tree *expr_p, gimple_seq *pre_p)
+{
+  tree decl_s = COMPOUND_LITERAL_EXPR_DECL_EXPR (*expr_p);
+  tree decl = DECL_EXPR_DECL (decl_s);
+  /* Mark the decl as addressable if the compound literal
+     expression is addressable now, otherwise it is marked too late
+     after we gimplify the initialization expression.  */
+  if (TREE_ADDRESSABLE (*expr_p))
+    TREE_ADDRESSABLE (decl) = 1;
+
+  /* Preliminarily mark non-addressed complex variables as eligible
+     for promotion to gimple registers.  We'll transform their uses
+     as we find them.  */
+  if ((TREE_CODE (TREE_TYPE (decl)) == COMPLEX_TYPE
+       || TREE_CODE (TREE_TYPE (decl)) == VECTOR_TYPE)
+      && !TREE_THIS_VOLATILE (decl)
+      && !needs_to_live_in_memory (decl))
+    DECL_GIMPLE_REG_P (decl) = 1;
+
+  /* This decl isn't mentioned in the enclosing block, so add it to the
+     list of temps.  FIXME it seems a bit of a kludge to say that
+     anonymous artificial vars aren't pushed, but everything else is.  */
+  if (DECL_NAME (decl) == NULL_TREE && !DECL_SEEN_IN_BIND_EXPR_P (decl))
+    gimple_add_tmp_var (decl);
+
+  gimplify_and_add (decl_s, pre_p);
+  *expr_p = decl;
+  return GS_OK;
+}
+
+/* Optimize embedded COMPOUND_LITERAL_EXPRs within a CONSTRUCTOR,
+   return a new CONSTRUCTOR if something changed.  */
+
+static tree
+optimize_compound_literals_in_ctor (tree orig_ctor)
+{
+  tree ctor = orig_ctor;
+  VEC(constructor_elt,gc) *elts = CONSTRUCTOR_ELTS (ctor);
+  unsigned int idx, num = VEC_length (constructor_elt, elts);
+
+  for (idx = 0; idx < num; idx++)
+    {
+      tree value = VEC_index (constructor_elt, elts, idx)->value;
+      tree newval = value;
+      if (TREE_CODE (value) == CONSTRUCTOR)
+    newval = optimize_compound_literals_in_ctor (value);
+      else if (TREE_CODE (value) == COMPOUND_LITERAL_EXPR)
+    {
+      tree decl_s = COMPOUND_LITERAL_EXPR_DECL_EXPR (value);
+      tree decl = DECL_EXPR_DECL (decl_s);
+      tree init = DECL_INITIAL (decl);
+
+      if (!TREE_ADDRESSABLE (value)
+          && !TREE_ADDRESSABLE (decl)
+          && init)
+        newval = optimize_compound_literals_in_ctor (init);
+    }
+      if (newval == value)
+    continue;
+
+      if (ctor == orig_ctor)
+    {
+      ctor = copy_node (orig_ctor);
+      CONSTRUCTOR_ELTS (ctor) = VEC_copy (constructor_elt, gc, elts);
+      elts = CONSTRUCTOR_ELTS (ctor);
+    }
+      VEC_index (constructor_elt, elts, idx)->value = newval;
+    }
+  return ctor;
+}
+
 
 
 /* A subroutine of gimplify_modify_expr.  Break out elements of a
@@ -3524,26 +3584,26 @@
 
 static enum gimplify_status
 gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
-			   bool want_value, bool notify_temp_creation)
-{
-  tree object;
-  tree ctor = TREE_OPERAND (*expr_p, 1);
-  tree type = TREE_TYPE (ctor);
+               bool want_value, bool notify_temp_creation)
+{
+  tree object, ctor, type;
   enum gimplify_status ret;
   VEC(constructor_elt,gc) *elts;
 
-  if (TREE_CODE (ctor) != CONSTRUCTOR)
-    return GS_UNHANDLED;
+  gcc_assert (TREE_CODE (TREE_OPERAND (*expr_p, 1)) == CONSTRUCTOR);
 
   if (!notify_temp_creation)
     {
       ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
-			   is_gimple_lvalue, fb_lvalue);
+               is_gimple_lvalue, fb_lvalue);
       if (ret == GS_ERROR)
-	return ret;
+    return ret;
     }
 
   object = TREE_OPERAND (*expr_p, 0);
+  ctor = TREE_OPERAND (*expr_p, 1) =
+    optimize_compound_literals_in_ctor (TREE_OPERAND (*expr_p, 1));
+  type = TREE_TYPE (ctor);
   elts = CONSTRUCTOR_ELTS (ctor);
   ret = GS_ALL_DONE;
 
@@ -3554,279 +3614,279 @@
     case QUAL_UNION_TYPE:
     case ARRAY_TYPE:
       {
-	struct gimplify_init_ctor_preeval_data preeval_data;
-	HOST_WIDE_INT num_type_elements, num_ctor_elements;
-	HOST_WIDE_INT num_nonzero_elements;
-	bool cleared, valid_const_initializer;
-
-	/* Aggregate types must lower constructors to initialization of
-	   individual elements.  The exception is that a CONSTRUCTOR node
-	   with no elements indicates zero-initialization of the whole.  */
-	if (VEC_empty (constructor_elt, elts))
-	  {
-	    if (notify_temp_creation)
-	      return GS_OK;
-	    break;
-	  }
- 
-	/* Fetch information about the constructor to direct later processing.
-	   We might want to make static versions of it in various cases, and
-	   can only do so if it known to be a valid constant initializer.  */
-	valid_const_initializer
-	  = categorize_ctor_elements (ctor, &num_nonzero_elements,
-				      &num_ctor_elements, &cleared);
-
-	/* If a const aggregate variable is being initialized, then it
-	   should never be a lose to promote the variable to be static.  */
-	if (valid_const_initializer
-	    && num_nonzero_elements > 1
-	    && TREE_READONLY (object)
-	    && TREE_CODE (object) == VAR_DECL
-	    && (flag_merge_constants >= 2 || !TREE_ADDRESSABLE (object)))
-	  {
-	    if (notify_temp_creation)
-	      return GS_ERROR;
-	    DECL_INITIAL (object) = ctor;
-	    TREE_STATIC (object) = 1;
-	    if (!DECL_NAME (object))
-	      DECL_NAME (object) = create_tmp_var_name ("C");
-	    walk_tree (&DECL_INITIAL (object), force_labels_r, NULL, NULL);
-
-	    /* ??? C++ doesn't automatically append a .<number> to the
-	       assembler name, and even when it does, it looks a FE private
-	       data structures to figure out what that number should be,
-	       which are not set for this variable.  I suppose this is
-	       important for local statics for inline functions, which aren't
-	       "local" in the object file sense.  So in order to get a unique
-	       TU-local symbol, we must invoke the lhd version now.  */
-	    lhd_set_decl_assembler_name (object);
-
-	    *expr_p = NULL_TREE;
-	    break;
-	  }
-
-	/* If there are "lots" of initialized elements, even discounting
-	   those that are not address constants (and thus *must* be
-	   computed at runtime), then partition the constructor into
-	   constant and non-constant parts.  Block copy the constant
-	   parts in, then generate code for the non-constant parts.  */
-	/* TODO.  There's code in cp/typeck.c to do this.  */
-
-	num_type_elements = count_type_elements (type, true);
-
-	/* If count_type_elements could not determine number of type elements
-	   for a constant-sized object, assume clearing is needed.
-	   Don't do this for variable-sized objects, as store_constructor
-	   will ignore the clearing of variable-sized objects.  */
-	if (num_type_elements < 0 && int_size_in_bytes (type) >= 0)
-	  cleared = true;
-	/* If there are "lots" of zeros, then block clear the object first.  */
-	else if (num_type_elements - num_nonzero_elements
-		 > CLEAR_RATIO (optimize_function_for_speed_p (cfun))
-		 && num_nonzero_elements < num_type_elements/4)
-	  cleared = true;
-	/* ??? This bit ought not be needed.  For any element not present
-	   in the initializer, we should simply set them to zero.  Except
-	   we'd need to *find* the elements that are not present, and that
-	   requires trickery to avoid quadratic compile-time behavior in
-	   large cases or excessive memory use in small cases.  */
-	else if (num_ctor_elements < num_type_elements)
-	  cleared = true;
-
-	/* If there are "lots" of initialized elements, and all of them
-	   are valid address constants, then the entire initializer can
-	   be dropped to memory, and then memcpy'd out.  Don't do this
-	   for sparse arrays, though, as it's more efficient to follow
-	   the standard CONSTRUCTOR behavior of memset followed by
-	   individual element initialization.  Also don't do this for small
-	   all-zero initializers (which aren't big enough to merit
-	   clearing), and don't try to make bitwise copies of
-	   TREE_ADDRESSABLE types.  */
-	if (valid_const_initializer
-	    && !(cleared || num_nonzero_elements == 0)
-	    && !TREE_ADDRESSABLE (type))
-	  {
-	    HOST_WIDE_INT size = int_size_in_bytes (type);
-	    unsigned int align;
-
-	    /* ??? We can still get unbounded array types, at least
-	       from the C++ front end.  This seems wrong, but attempt
-	       to work around it for now.  */
-	    if (size < 0)
-	      {
-		size = int_size_in_bytes (TREE_TYPE (object));
-		if (size >= 0)
-		  TREE_TYPE (ctor) = type = TREE_TYPE (object);
-	      }
-
-	    /* Find the maximum alignment we can assume for the object.  */
-	    /* ??? Make use of DECL_OFFSET_ALIGN.  */
-	    if (DECL_P (object))
-	      align = DECL_ALIGN (object);
-	    else
-	      align = TYPE_ALIGN (type);
-
-	    if (size > 0
-		&& num_nonzero_elements > 1
-		&& !can_move_by_pieces (size, align))
-	      {
-		tree new_tree;
-
-		if (notify_temp_creation)
-		  return GS_ERROR;
-
-		new_tree = create_tmp_var_raw (type, "C");
-
-		gimple_add_tmp_var (new_tree);
-		TREE_STATIC (new_tree) = 1;
-		TREE_READONLY (new_tree) = 1;
-		DECL_INITIAL (new_tree) = ctor;
-		if (align > DECL_ALIGN (new_tree))
-		  {
-		    DECL_ALIGN (new_tree) = align;
-		    DECL_USER_ALIGN (new_tree) = 1;
-		  }
-	        walk_tree (&DECL_INITIAL (new_tree), force_labels_r, NULL, NULL);
-
-		TREE_OPERAND (*expr_p, 1) = new_tree;
-
-		/* This is no longer an assignment of a CONSTRUCTOR, but
-		   we still may have processing to do on the LHS.  So
-		   pretend we didn't do anything here to let that happen.  */
-		return GS_UNHANDLED;
-	      }
-	  }
-
-	if (notify_temp_creation)
-	  return GS_OK;
-
-	/* If there are nonzero elements, pre-evaluate to capture elements
-	   overlapping with the lhs into temporaries.  We must do this before
-	   clearing to fetch the values before they are zeroed-out.  */
-	if (num_nonzero_elements > 0)
-	  {
-	    preeval_data.lhs_base_decl = get_base_address (object);
-	    if (!DECL_P (preeval_data.lhs_base_decl))
-	      preeval_data.lhs_base_decl = NULL;
-	    preeval_data.lhs_alias_set = get_alias_set (object);
-
-	    gimplify_init_ctor_preeval (&TREE_OPERAND (*expr_p, 1),
-					pre_p, post_p, &preeval_data);
-	  }
-
-	if (cleared)
-	  {
-	    /* Zap the CONSTRUCTOR element list, which simplifies this case.
-	       Note that we still have to gimplify, in order to handle the
-	       case of variable sized types.  Avoid shared tree structures.  */
-	    CONSTRUCTOR_ELTS (ctor) = NULL;
-	    TREE_SIDE_EFFECTS (ctor) = 0;
-	    object = unshare_expr (object);
-	    gimplify_stmt (expr_p, pre_p);
-	  }
-
-	/* If we have not block cleared the object, or if there are nonzero
-	   elements in the constructor, add assignments to the individual
-	   scalar fields of the object.  */
-	if (!cleared || num_nonzero_elements > 0)
-	  gimplify_init_ctor_eval (object, elts, pre_p, cleared);
-
-	*expr_p = NULL_TREE;
+    struct gimplify_init_ctor_preeval_data preeval_data;
+    HOST_WIDE_INT num_type_elements, num_ctor_elements;
+    HOST_WIDE_INT num_nonzero_elements;
+    bool cleared, valid_const_initializer;
+
+    /* Aggregate types must lower constructors to initialization of
+       individual elements.  The exception is that a CONSTRUCTOR node
+       with no elements indicates zero-initialization of the whole.  */
+    if (VEC_empty (constructor_elt, elts))
+      {
+        if (notify_temp_creation)
+          return GS_OK;
+        break;
+      }
+
+    /* Fetch information about the constructor to direct later processing.
+       We might want to make static versions of it in various cases, and
+       can only do so if it known to be a valid constant initializer.  */
+    valid_const_initializer
+      = categorize_ctor_elements (ctor, &num_nonzero_elements,
+                      &num_ctor_elements, &cleared);
+
+    /* If a const aggregate variable is being initialized, then it
+       should never be a lose to promote the variable to be static.  */
+    if (valid_const_initializer
+        && num_nonzero_elements > 1
+        && TREE_READONLY (object)
+        && TREE_CODE (object) == VAR_DECL
+        && (flag_merge_constants >= 2 || !TREE_ADDRESSABLE (object)))
+      {
+        if (notify_temp_creation)
+          return GS_ERROR;
+        DECL_INITIAL (object) = ctor;
+        TREE_STATIC (object) = 1;
+        if (!DECL_NAME (object))
+          DECL_NAME (object) = create_tmp_var_name ("C");
+        walk_tree (&DECL_INITIAL (object), force_labels_r, NULL, NULL);
+
+        /* ??? C++ doesn't automatically append a .<number> to the
+           assembler name, and even when it does, it looks a FE private
+           data structures to figure out what that number should be,
+           which are not set for this variable.  I suppose this is
+           important for local statics for inline functions, which aren't
+           "local" in the object file sense.  So in order to get a unique
+           TU-local symbol, we must invoke the lhd version now.  */
+        lhd_set_decl_assembler_name (object);
+
+        *expr_p = NULL_TREE;
+        break;
+      }
+
+    /* If there are "lots" of initialized elements, even discounting
+       those that are not address constants (and thus *must* be
+       computed at runtime), then partition the constructor into
+       constant and non-constant parts.  Block copy the constant
+       parts in, then generate code for the non-constant parts.  */
+    /* TODO.  There's code in cp/typeck.c to do this.  */
+
+    num_type_elements = count_type_elements (type, true);
+
+    /* If count_type_elements could not determine number of type elements
+       for a constant-sized object, assume clearing is needed.
+       Don't do this for variable-sized objects, as store_constructor
+       will ignore the clearing of variable-sized objects.  */
+    if (num_type_elements < 0 && int_size_in_bytes (type) >= 0)
+      cleared = true;
+    /* If there are "lots" of zeros, then block clear the object first.  */
+    else if (num_type_elements - num_nonzero_elements
+         > CLEAR_RATIO (optimize_function_for_speed_p (cfun))
+         && num_nonzero_elements < num_type_elements/4)
+      cleared = true;
+    /* ??? This bit ought not be needed.  For any element not present
+       in the initializer, we should simply set them to zero.  Except
+       we'd need to *find* the elements that are not present, and that
+       requires trickery to avoid quadratic compile-time behavior in
+       large cases or excessive memory use in small cases.  */
+    else if (num_ctor_elements < num_type_elements)
+      cleared = true;
+
+    /* If there are "lots" of initialized elements, and all of them
+       are valid address constants, then the entire initializer can
+       be dropped to memory, and then memcpy'd out.  Don't do this
+       for sparse arrays, though, as it's more efficient to follow
+       the standard CONSTRUCTOR behavior of memset followed by
+       individual element initialization.  Also don't do this for small
+       all-zero initializers (which aren't big enough to merit
+       clearing), and don't try to make bitwise copies of
+       TREE_ADDRESSABLE types.  */
+    if (valid_const_initializer
+        && !(cleared || num_nonzero_elements == 0)
+        && !TREE_ADDRESSABLE (type))
+      {
+        HOST_WIDE_INT size = int_size_in_bytes (type);
+        unsigned int align;
+
+        /* ??? We can still get unbounded array types, at least
+           from the C++ front end.  This seems wrong, but attempt
+           to work around it for now.  */
+        if (size < 0)
+          {
+        size = int_size_in_bytes (TREE_TYPE (object));
+        if (size >= 0)
+          TREE_TYPE (ctor) = type = TREE_TYPE (object);
+          }
+
+        /* Find the maximum alignment we can assume for the object.  */
+        /* ??? Make use of DECL_OFFSET_ALIGN.  */
+        if (DECL_P (object))
+          align = DECL_ALIGN (object);
+        else
+          align = TYPE_ALIGN (type);
+
+        if (size > 0
+        && num_nonzero_elements > 1
+        && !can_move_by_pieces (size, align))
+          {
+        tree new_tree;
+
+        if (notify_temp_creation)
+          return GS_ERROR;
+
+        new_tree = create_tmp_var_raw (type, "C");
+
+        gimple_add_tmp_var (new_tree);
+        TREE_STATIC (new_tree) = 1;
+        TREE_READONLY (new_tree) = 1;
+        DECL_INITIAL (new_tree) = ctor;
+        if (align > DECL_ALIGN (new_tree))
+          {
+            DECL_ALIGN (new_tree) = align;
+            DECL_USER_ALIGN (new_tree) = 1;
+          }
+            walk_tree (&DECL_INITIAL (new_tree), force_labels_r, NULL, NULL);
+
+        TREE_OPERAND (*expr_p, 1) = new_tree;
+
+        /* This is no longer an assignment of a CONSTRUCTOR, but
+           we still may have processing to do on the LHS.  So
+           pretend we didn't do anything here to let that happen.  */
+        return GS_UNHANDLED;
+          }
+      }
+
+    if (notify_temp_creation)
+      return GS_OK;
+
+    /* If there are nonzero elements, pre-evaluate to capture elements
+       overlapping with the lhs into temporaries.  We must do this before
+       clearing to fetch the values before they are zeroed-out.  */
+    if (num_nonzero_elements > 0)
+      {
+        preeval_data.lhs_base_decl = get_base_address (object);
+        if (!DECL_P (preeval_data.lhs_base_decl))
+          preeval_data.lhs_base_decl = NULL;
+        preeval_data.lhs_alias_set = get_alias_set (object);
+
+        gimplify_init_ctor_preeval (&TREE_OPERAND (*expr_p, 1),
+                    pre_p, post_p, &preeval_data);
+      }
+
+    if (cleared)
+      {
+        /* Zap the CONSTRUCTOR element list, which simplifies this case.
+           Note that we still have to gimplify, in order to handle the
+           case of variable sized types.  Avoid shared tree structures.  */
+        CONSTRUCTOR_ELTS (ctor) = NULL;
+        TREE_SIDE_EFFECTS (ctor) = 0;
+        object = unshare_expr (object);
+        gimplify_stmt (expr_p, pre_p);
+      }
+
+    /* If we have not block cleared the object, or if there are nonzero
+       elements in the constructor, add assignments to the individual
+       scalar fields of the object.  */
+    if (!cleared || num_nonzero_elements > 0)
+      gimplify_init_ctor_eval (object, elts, pre_p, cleared);
+
+    *expr_p = NULL_TREE;
       }
       break;
 
     case COMPLEX_TYPE:
       {
-	tree r, i;
-
-	if (notify_temp_creation)
-	  return GS_OK;
-
-	/* Extract the real and imaginary parts out of the ctor.  */
-	gcc_assert (VEC_length (constructor_elt, elts) == 2);
-	r = VEC_index (constructor_elt, elts, 0)->value;
-	i = VEC_index (constructor_elt, elts, 1)->value;
-	if (r == NULL || i == NULL)
-	  {
-	    tree zero = fold_convert (TREE_TYPE (type), integer_zero_node);
-	    if (r == NULL)
-	      r = zero;
-	    if (i == NULL)
-	      i = zero;
-	  }
-
-	/* Complex types have either COMPLEX_CST or COMPLEX_EXPR to
-	   represent creation of a complex value.  */
-	if (TREE_CONSTANT (r) && TREE_CONSTANT (i))
-	  {
-	    ctor = build_complex (type, r, i);
-	    TREE_OPERAND (*expr_p, 1) = ctor;
-	  }
-	else
-	  {
-	    ctor = build2 (COMPLEX_EXPR, type, r, i);
-	    TREE_OPERAND (*expr_p, 1) = ctor;
-	    ret = gimplify_expr (&TREE_OPERAND (*expr_p, 1),
-				 pre_p,
-				 post_p,
-				 rhs_predicate_for (TREE_OPERAND (*expr_p, 0)),
-				 fb_rvalue);
-	  }
+    tree r, i;
+
+    if (notify_temp_creation)
+      return GS_OK;
+
+    /* Extract the real and imaginary parts out of the ctor.  */
+    gcc_assert (VEC_length (constructor_elt, elts) == 2);
+    r = VEC_index (constructor_elt, elts, 0)->value;
+    i = VEC_index (constructor_elt, elts, 1)->value;
+    if (r == NULL || i == NULL)
+      {
+        tree zero = fold_convert (TREE_TYPE (type), integer_zero_node);
+        if (r == NULL)
+          r = zero;
+        if (i == NULL)
+          i = zero;
+      }
+
+    /* Complex types have either COMPLEX_CST or COMPLEX_EXPR to
+       represent creation of a complex value.  */
+    if (TREE_CONSTANT (r) && TREE_CONSTANT (i))
+      {
+        ctor = build_complex (type, r, i);
+        TREE_OPERAND (*expr_p, 1) = ctor;
+      }
+    else
+      {
+        ctor = build2 (COMPLEX_EXPR, type, r, i);
+        TREE_OPERAND (*expr_p, 1) = ctor;
+        ret = gimplify_expr (&TREE_OPERAND (*expr_p, 1),
+                 pre_p,
+                 post_p,
+                 rhs_predicate_for (TREE_OPERAND (*expr_p, 0)),
+                 fb_rvalue);
+      }
       }
       break;
 
     case VECTOR_TYPE:
       {
-	unsigned HOST_WIDE_INT ix;
-	constructor_elt *ce;
-
-	if (notify_temp_creation)
-	  return GS_OK;
-
-	/* Go ahead and simplify constant constructors to VECTOR_CST.  */
-	if (TREE_CONSTANT (ctor))
-	  {
-	    bool constant_p = true;
-	    tree value;
-
-	    /* Even when ctor is constant, it might contain non-*_CST
-	       elements, such as addresses or trapping values like
-	       1.0/0.0 - 1.0/0.0.  Such expressions don't belong
-	       in VECTOR_CST nodes.  */
-	    FOR_EACH_CONSTRUCTOR_VALUE (elts, ix, value)
-	      if (!CONSTANT_CLASS_P (value))
-		{
-		  constant_p = false;
-		  break;
-		}
-
-	    if (constant_p)
-	      {
-		TREE_OPERAND (*expr_p, 1) = build_vector_from_ctor (type, elts);
-		break;
-	      }
-
-	    /* Don't reduce an initializer constant even if we can't
-	       make a VECTOR_CST.  It won't do anything for us, and it'll
-	       prevent us from representing it as a single constant.  */
-	    if (initializer_constant_valid_p (ctor, type))
-	      break;
-
-	    TREE_CONSTANT (ctor) = 0;
-	  }
-
-	/* Vector types use CONSTRUCTOR all the way through gimple
-	  compilation as a general initializer.  */
-	for (ix = 0; VEC_iterate (constructor_elt, elts, ix, ce); ix++)
-	  {
-	    enum gimplify_status tret;
-	    tret = gimplify_expr (&ce->value, pre_p, post_p, is_gimple_val,
-				  fb_rvalue);
-	    if (tret == GS_ERROR)
-	      ret = GS_ERROR;
-	  }
-	if (!is_gimple_reg (TREE_OPERAND (*expr_p, 0)))
-	  TREE_OPERAND (*expr_p, 1) = get_formal_tmp_var (ctor, pre_p);
+    unsigned HOST_WIDE_INT ix;
+    constructor_elt *ce;
+
+    if (notify_temp_creation)
+      return GS_OK;
+
+    /* Go ahead and simplify constant constructors to VECTOR_CST.  */
+    if (TREE_CONSTANT (ctor))
+      {
+        bool constant_p = true;
+        tree value;
+
+        /* Even when ctor is constant, it might contain non-*_CST
+           elements, such as addresses or trapping values like
+           1.0/0.0 - 1.0/0.0.  Such expressions don't belong
+           in VECTOR_CST nodes.  */
+        FOR_EACH_CONSTRUCTOR_VALUE (elts, ix, value)
+          if (!CONSTANT_CLASS_P (value))
+        {
+          constant_p = false;
+          break;
+        }
+
+        if (constant_p)
+          {
+        TREE_OPERAND (*expr_p, 1) = build_vector_from_ctor (type, elts);
+        break;
+          }
+
+        /* Don't reduce an initializer constant even if we can't
+           make a VECTOR_CST.  It won't do anything for us, and it'll
+           prevent us from representing it as a single constant.  */
+        if (initializer_constant_valid_p (ctor, type))
+          break;
+
+        TREE_CONSTANT (ctor) = 0;
+      }
+
+    /* Vector types use CONSTRUCTOR all the way through gimple
+      compilation as a general initializer.  */
+    for (ix = 0; VEC_iterate (constructor_elt, elts, ix, ce); ix++)
+      {
+        enum gimplify_status tret;
+        tret = gimplify_expr (&ce->value, pre_p, post_p, is_gimple_val,
+                  fb_rvalue);
+        if (tret == GS_ERROR)
+          ret = GS_ERROR;
+      }
+    if (!is_gimple_reg (TREE_OPERAND (*expr_p, 0)))
+      TREE_OPERAND (*expr_p, 1) = get_formal_tmp_var (ctor, pre_p);
       }
       break;
 
@@ -3845,15 +3905,15 @@
   else
     {
       /* If we have gimplified both sides of the initializer but have
-	 not emitted an assignment, do so now.  */
+     not emitted an assignment, do so now.  */
       if (*expr_p)
-	{
-	  tree lhs = TREE_OPERAND (*expr_p, 0);
-	  tree rhs = TREE_OPERAND (*expr_p, 1);
-	  gimple init = gimple_build_assign (lhs, rhs);
-	  gimplify_seq_add_stmt (pre_p, init);
-	  *expr_p = NULL;
-	}
+    {
+      tree lhs = TREE_OPERAND (*expr_p, 0);
+      tree rhs = TREE_OPERAND (*expr_p, 1);
+      gimple init = gimple_build_assign (lhs, rhs);
+      gimplify_seq_add_stmt (pre_p, init);
+      *expr_p = NULL;
+    }
 
       return GS_ALL_DONE;
     }
@@ -3887,7 +3947,7 @@
 
       /* *(foo *)&fooarray => fooarray[0] */
       if (TREE_CODE (optype) == ARRAY_TYPE
-	  && useless_type_conversion_p (type, TREE_TYPE (optype)))
+      && useless_type_conversion_p (type, TREE_TYPE (optype)))
        {
          tree type_domain = TYPE_DOMAIN (optype);
          tree min_val = size_zero_node;
@@ -3906,7 +3966,7 @@
       tree osub = sub;
       sub = gimple_fold_indirect_ref (sub);
       if (! sub)
-	sub = build1 (INDIRECT_REF, TREE_TYPE (subtype), osub);
+    sub = build1 (INDIRECT_REF, TREE_TYPE (subtype), osub);
       type_domain = TYPE_DOMAIN (TREE_TYPE (sub));
       if (type_domain && TYPE_MIN_VALUE (type_domain))
         min_val = TYPE_MIN_VALUE (type_domain);
@@ -3935,8 +3995,8 @@
 
 static enum gimplify_status
 gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p,
-			  gimple_seq *pre_p, gimple_seq *post_p,
-			  bool want_value)
+              gimple_seq *pre_p, gimple_seq *post_p,
+              bool want_value)
 {
   enum gimplify_status ret = GS_OK;
 
@@ -3944,216 +4004,234 @@
     switch (TREE_CODE (*from_p))
       {
       case VAR_DECL:
-	/* If we're assigning from a constant constructor, move the
-	   constructor expression to the RHS of the MODIFY_EXPR.  */
-	if (DECL_INITIAL (*from_p)
-	    && TREE_READONLY (*from_p)
-	    && !TREE_THIS_VOLATILE (*from_p)
-	    && TREE_CODE (DECL_INITIAL (*from_p)) == CONSTRUCTOR)
-	  {
-	    tree old_from = *from_p;
-
-	    /* Move the constructor into the RHS.  */
-	    *from_p = unshare_expr (DECL_INITIAL (*from_p));
-
-	    /* Let's see if gimplify_init_constructor will need to put
-	       it in memory.  If so, revert the change.  */
-	    ret = gimplify_init_constructor (expr_p, NULL, NULL, false, true);
-	    if (ret == GS_ERROR)
-	      {
-		*from_p = old_from;
-		/* Fall through.  */
-	      }
-	    else
-	      {
-		ret = GS_OK;
-		break;
-	      }
-	  }
-	ret = GS_UNHANDLED;
-	break;
+    /* If we're assigning from a read-only variable initialized with
+       a constructor, do the direct assignment from the constructor,
+       but only if neither source nor target are volatile since this
+       latter assignment might end up being done on a per-field basis.  */
+    if (DECL_INITIAL (*from_p)
+        && TREE_READONLY (*from_p)
+        && !TREE_THIS_VOLATILE (*from_p)
+        && !TREE_THIS_VOLATILE (*to_p)
+        && TREE_CODE (DECL_INITIAL (*from_p)) == CONSTRUCTOR)
+      {
+        tree old_from = *from_p;
+
+        /* Move the constructor into the RHS.  */
+        *from_p = unshare_expr (DECL_INITIAL (*from_p));
+
+        /* Let's see if gimplify_init_constructor will need to put
+           it in memory.  If so, revert the change.  */
+        ret = gimplify_init_constructor (expr_p, NULL, NULL, false, true);
+        if (ret == GS_ERROR)
+          {
+        *from_p = old_from;
+        /* Fall through.  */
+          }
+        else
+          {
+        ret = GS_OK;
+        break;
+          }
+      }
+    ret = GS_UNHANDLED;
+    break;
       case INDIRECT_REF:
-	{
-	  /* If we have code like 
-
-	        *(const A*)(A*)&x
-
-	     where the type of "x" is a (possibly cv-qualified variant
-	     of "A"), treat the entire expression as identical to "x".
-	     This kind of code arises in C++ when an object is bound
-	     to a const reference, and if "x" is a TARGET_EXPR we want
-	     to take advantage of the optimization below.  */
-	  tree t = gimple_fold_indirect_ref_rhs (TREE_OPERAND (*from_p, 0));
-	  if (t)
-	    {
-	      *from_p = t;
-	      ret = GS_OK;
-	    }
-	  else
-	    ret = GS_UNHANDLED;
-	  break;
-	}
+    {
+      /* If we have code like
+
+            *(const A*)(A*)&x
+
+         where the type of "x" is a (possibly cv-qualified variant
+         of "A"), treat the entire expression as identical to "x".
+         This kind of code arises in C++ when an object is bound
+         to a const reference, and if "x" is a TARGET_EXPR we want
+         to take advantage of the optimization below.  */
+      tree t = gimple_fold_indirect_ref_rhs (TREE_OPERAND (*from_p, 0));
+      if (t)
+        {
+          *from_p = t;
+          ret = GS_OK;
+        }
+      else
+        ret = GS_UNHANDLED;
+      break;
+    }
 
       case TARGET_EXPR:
-	{
-	  /* If we are initializing something from a TARGET_EXPR, strip the
-	     TARGET_EXPR and initialize it directly, if possible.  This can't
-	     be done if the initializer is void, since that implies that the
-	     temporary is set in some non-trivial way.
-
-	     ??? What about code that pulls out the temp and uses it
-	     elsewhere? I think that such code never uses the TARGET_EXPR as
-	     an initializer.  If I'm wrong, we'll die because the temp won't
-	     have any RTL.  In that case, I guess we'll need to replace
-	     references somehow.  */
-	  tree init = TARGET_EXPR_INITIAL (*from_p);
-
-	  if (init
-	      && !VOID_TYPE_P (TREE_TYPE (init)))
-	    {
-	      *from_p = init;
-	      ret = GS_OK;
-	    }
-	  else
-	    ret = GS_UNHANDLED;
-	}
-	break;
+    {
+      /* If we are initializing something from a TARGET_EXPR, strip the
+         TARGET_EXPR and initialize it directly, if possible.  This can't
+         be done if the initializer is void, since that implies that the
+         temporary is set in some non-trivial way.
+
+         ??? What about code that pulls out the temp and uses it
+         elsewhere? I think that such code never uses the TARGET_EXPR as
+         an initializer.  If I'm wrong, we'll die because the temp won't
+         have any RTL.  In that case, I guess we'll need to replace
+         references somehow.  */
+      tree init = TARGET_EXPR_INITIAL (*from_p);
+
+      if (init
+          && !VOID_TYPE_P (TREE_TYPE (init)))
+        {
+          *from_p = init;
+          ret = GS_OK;
+        }
+      else
+        ret = GS_UNHANDLED;
+    }
+    break;
 
       case COMPOUND_EXPR:
-	/* Remove any COMPOUND_EXPR in the RHS so the following cases will be
-	   caught.  */
-	gimplify_compound_expr (from_p, pre_p, true);
-	ret = GS_OK;
-	break;
+    /* Remove any COMPOUND_EXPR in the RHS so the following cases will be
+       caught.  */
+    gimplify_compound_expr (from_p, pre_p, true);
+    ret = GS_OK;
+    break;
 
       case CONSTRUCTOR:
-	/* If we're initializing from a CONSTRUCTOR, break this into
-	   individual MODIFY_EXPRs.  */
-	return gimplify_init_constructor (expr_p, pre_p, post_p, want_value,
-					  false);
+    /* If we're initializing from a CONSTRUCTOR, break this into
+       individual MODIFY_EXPRs.  */
+    return gimplify_init_constructor (expr_p, pre_p, post_p, want_value,
+                      false);
 
       case COND_EXPR:
-	/* If we're assigning to a non-register type, push the assignment
-	   down into the branches.  This is mandatory for ADDRESSABLE types,
-	   since we cannot generate temporaries for such, but it saves a
-	   copy in other cases as well.  */
-	if (!is_gimple_reg_type (TREE_TYPE (*from_p)))
-	  {
-	    /* This code should mirror the code in gimplify_cond_expr. */
-	    enum tree_code code = TREE_CODE (*expr_p);
-	    tree cond = *from_p;
-	    tree result = *to_p;
-
-	    ret = gimplify_expr (&result, pre_p, post_p,
-				 is_gimple_lvalue, fb_lvalue);
-	    if (ret != GS_ERROR)
-	      ret = GS_OK;
-
-	    if (TREE_TYPE (TREE_OPERAND (cond, 1)) != void_type_node)
-	      TREE_OPERAND (cond, 1)
-		= build2 (code, void_type_node, result,
-			  TREE_OPERAND (cond, 1));
-	    if (TREE_TYPE (TREE_OPERAND (cond, 2)) != void_type_node)
-	      TREE_OPERAND (cond, 2)
-		= build2 (code, void_type_node, unshare_expr (result),
-			  TREE_OPERAND (cond, 2));
-
-	    TREE_TYPE (cond) = void_type_node;
-	    recalculate_side_effects (cond);
-
-	    if (want_value)
-	      {
-		gimplify_and_add (cond, pre_p);
-		*expr_p = unshare_expr (result);
-	      }
-	    else
-	      *expr_p = cond;
-	    return ret;
-	  }
-	else
-	  ret = GS_UNHANDLED;
-	break;
+    /* If we're assigning to a non-register type, push the assignment
+       down into the branches.  This is mandatory for ADDRESSABLE types,
+       since we cannot generate temporaries for such, but it saves a
+       copy in other cases as well.  */
+    if (!is_gimple_reg_type (TREE_TYPE (*from_p)))
+      {
+        /* This code should mirror the code in gimplify_cond_expr. */
+        enum tree_code code = TREE_CODE (*expr_p);
+        tree cond = *from_p;
+        tree result = *to_p;
+
+        ret = gimplify_expr (&result, pre_p, post_p,
+                 is_gimple_lvalue, fb_lvalue);
+        if (ret != GS_ERROR)
+          ret = GS_OK;
+
+        if (TREE_TYPE (TREE_OPERAND (cond, 1)) != void_type_node)
+          TREE_OPERAND (cond, 1)
+        = build2 (code, void_type_node, result,
+              TREE_OPERAND (cond, 1));
+        if (TREE_TYPE (TREE_OPERAND (cond, 2)) != void_type_node)
+          TREE_OPERAND (cond, 2)
+        = build2 (code, void_type_node, unshare_expr (result),
+              TREE_OPERAND (cond, 2));
+
+        TREE_TYPE (cond) = void_type_node;
+        recalculate_side_effects (cond);
+
+        if (want_value)
+          {
+        gimplify_and_add (cond, pre_p);
+        *expr_p = unshare_expr (result);
+          }
+        else
+          *expr_p = cond;
+        return ret;
+      }
+    else
+      ret = GS_UNHANDLED;
+    break;
 
       case CALL_EXPR:
-	/* For calls that return in memory, give *to_p as the CALL_EXPR's
-	   return slot so that we don't generate a temporary.  */
-	if (!CALL_EXPR_RETURN_SLOT_OPT (*from_p)
-	    && aggregate_value_p (*from_p, *from_p))
-	  {
-	    bool use_target;
-
-	    if (!(rhs_predicate_for (*to_p))(*from_p))
-	      /* If we need a temporary, *to_p isn't accurate.  */
-	      use_target = false;
-	    else if (TREE_CODE (*to_p) == RESULT_DECL
-		     && DECL_NAME (*to_p) == NULL_TREE
-		     && needs_to_live_in_memory (*to_p))
-	      /* It's OK to use the return slot directly unless it's an NRV. */
-	      use_target = true;
-	    else if (is_gimple_reg_type (TREE_TYPE (*to_p))
-		     || (DECL_P (*to_p) && DECL_REGISTER (*to_p)))
-	      /* Don't force regs into memory.  */
-	      use_target = false;
-	    else if (TREE_CODE (*to_p) == VAR_DECL
-		     && DECL_GIMPLE_FORMAL_TEMP_P (*to_p))
-	      /* Don't use the original target if it's a formal temp; we
-		 don't want to take their addresses.  */
-	      use_target = false;
-	    else if (TREE_CODE (*expr_p) == INIT_EXPR)
-	      /* It's OK to use the target directly if it's being
-		 initialized. */
-	      use_target = true;
-	    else if (!is_gimple_non_addressable (*to_p))
-	      /* Don't use the original target if it's already addressable;
-		 if its address escapes, and the called function uses the
-		 NRV optimization, a conforming program could see *to_p
-		 change before the called function returns; see c++/19317.
-		 When optimizing, the return_slot pass marks more functions
-		 as safe after we have escape info.  */
-	      use_target = false;
-	    else
-	      use_target = true;
-
-	    if (use_target)
-	      {
-		CALL_EXPR_RETURN_SLOT_OPT (*from_p) = 1;
-		mark_addressable (*to_p);
-	      }
-	  }
-
-	ret = GS_UNHANDLED;
-	break;
-
-	/* If we're initializing from a container, push the initialization
-	   inside it.  */
+    /* For calls that return in memory, give *to_p as the CALL_EXPR's
+       return slot so that we don't generate a temporary.  */
+    if (!CALL_EXPR_RETURN_SLOT_OPT (*from_p)
+        && aggregate_value_p (*from_p, *from_p))
+      {
+        bool use_target;
+
+        if (!(rhs_predicate_for (*to_p))(*from_p))
+          /* If we need a temporary, *to_p isn't accurate.  */
+          use_target = false;
+        else if (TREE_CODE (*to_p) == RESULT_DECL
+             && DECL_NAME (*to_p) == NULL_TREE
+             && needs_to_live_in_memory (*to_p))
+          /* It's OK to use the return slot directly unless it's an NRV. */
+          use_target = true;
+        else if (is_gimple_reg_type (TREE_TYPE (*to_p))
+             || (DECL_P (*to_p) && DECL_REGISTER (*to_p)))
+          /* Don't force regs into memory.  */
+          use_target = false;
+        else if (TREE_CODE (*expr_p) == INIT_EXPR)
+          /* It's OK to use the target directly if it's being
+         initialized. */
+          use_target = true;
+        else if (!is_gimple_non_addressable (*to_p))
+          /* Don't use the original target if it's already addressable;
+         if its address escapes, and the called function uses the
+         NRV optimization, a conforming program could see *to_p
+         change before the called function returns; see c++/19317.
+         When optimizing, the return_slot pass marks more functions
+         as safe after we have escape info.  */
+          use_target = false;
+        else
+          use_target = true;
+
+        if (use_target)
+          {
+        CALL_EXPR_RETURN_SLOT_OPT (*from_p) = 1;
+        mark_addressable (*to_p);
+          }
+      }
+
+    ret = GS_UNHANDLED;
+    break;
+
+    /* If we're initializing from a container, push the initialization
+       inside it.  */
       case CLEANUP_POINT_EXPR:
       case BIND_EXPR:
       case STATEMENT_LIST:
-	{
-	  tree wrap = *from_p;
-	  tree t;
-
-	  ret = gimplify_expr (to_p, pre_p, post_p, is_gimple_min_lval,
-			       fb_lvalue);
-	  if (ret != GS_ERROR)
-	    ret = GS_OK;
-
-	  t = voidify_wrapper_expr (wrap, *expr_p);
-	  gcc_assert (t == *expr_p);
-
-	  if (want_value)
-	    {
-	      gimplify_and_add (wrap, pre_p);
-	      *expr_p = unshare_expr (*to_p);
-	    }
-	  else
-	    *expr_p = wrap;
-	  return GS_OK;
-	}
-	
+    {
+      tree wrap = *from_p;
+      tree t;
+
+      ret = gimplify_expr (to_p, pre_p, post_p, is_gimple_min_lval,
+                   fb_lvalue);
+      if (ret != GS_ERROR)
+        ret = GS_OK;
+
+      t = voidify_wrapper_expr (wrap, *expr_p);
+      gcc_assert (t == *expr_p);
+
+      if (want_value)
+        {
+          gimplify_and_add (wrap, pre_p);
+          *expr_p = unshare_expr (*to_p);
+        }
+      else
+        *expr_p = wrap;
+      return GS_OK;
+    }
+
+      case COMPOUND_LITERAL_EXPR:
+    {
+      tree complit = TREE_OPERAND (*expr_p, 1);
+      tree decl_s = COMPOUND_LITERAL_EXPR_DECL_EXPR (complit);
+      tree decl = DECL_EXPR_DECL (decl_s);
+      tree init = DECL_INITIAL (decl);
+
+      /* struct T x = (struct T) { 0, 1, 2 } can be optimized
+         into struct T x = { 0, 1, 2 } if the address of the
+         compound literal has never been taken.  */
+      if (!TREE_ADDRESSABLE (complit)
+          && !TREE_ADDRESSABLE (decl)
+          && init)
+        {
+          *expr_p = copy_node (*expr_p);
+          TREE_OPERAND (*expr_p, 1) = init;
+          return GS_OK;
+        }
+    }
+
       default:
-	ret = GS_UNHANDLED;
-	break;
+    ret = GS_UNHANDLED;
+    break;
       }
 
   return ret;
@@ -4206,44 +4284,44 @@
 /* Gimplify the MODIFY_EXPR node pointed to by EXPR_P.
 
       modify_expr
-	      : varname '=' rhs
-	      | '*' ID '=' rhs
+          : varname '=' rhs
+          | '*' ID '=' rhs
 
     PRE_P points to the list where side effects that must happen before
-	*EXPR_P should be stored.
+    *EXPR_P should be stored.
 
     POST_P points to the list where side effects that must happen after
-	*EXPR_P should be stored.
+    *EXPR_P should be stored.
 
     WANT_VALUE is nonzero iff we want to use the value of this expression
-	in another expression.  */
+    in another expression.  */
 
 static enum gimplify_status
 gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
-		      bool want_value)
+              bool want_value)
 {
   tree *from_p = &TREE_OPERAND (*expr_p, 1);
   tree *to_p = &TREE_OPERAND (*expr_p, 0);
   enum gimplify_status ret = GS_UNHANDLED;
   gimple assign;
+  location_t loc = EXPR_LOCATION (*expr_p);
 
   gcc_assert (TREE_CODE (*expr_p) == MODIFY_EXPR
-	      || TREE_CODE (*expr_p) == INIT_EXPR);
+          || TREE_CODE (*expr_p) == INIT_EXPR);
 
   /* Insert pointer conversions required by the middle-end that are not
      required by the frontend.  This fixes middle-end type checking for
      for example gcc.dg/redecl-6.c.  */
-  if (POINTER_TYPE_P (TREE_TYPE (*to_p))
-      && lang_hooks.types_compatible_p (TREE_TYPE (*to_p), TREE_TYPE (*from_p)))
+  if (POINTER_TYPE_P (TREE_TYPE (*to_p)))
     {
       STRIP_USELESS_TYPE_CONVERSION (*from_p);
       if (!useless_type_conversion_p (TREE_TYPE (*to_p), TREE_TYPE (*from_p)))
-	*from_p = fold_convert (TREE_TYPE (*to_p), *from_p);
+    *from_p = fold_convert_loc (loc, TREE_TYPE (*to_p), *from_p);
     }
 
   /* See if any simplifications can be done based on what the RHS is.  */
   ret = gimplify_modify_expr_rhs (expr_p, from_p, to_p, pre_p, post_p,
-				  want_value);
+                  want_value);
   if (ret != GS_UNHANDLED)
     return ret;
 
@@ -4284,13 +4362,13 @@
      created GIMPLE_CALL <foo> will be the last statement in *PRE_P
      and all we need to do here is set 'a' to be its LHS.  */
   ret = gimplify_expr (from_p, pre_p, post_p, rhs_predicate_for (*to_p),
-		       fb_rvalue);
+               fb_rvalue);
   if (ret == GS_ERROR)
     return ret;
 
   /* Now see if the above changed *from_p to something we handle specially.  */
   ret = gimplify_modify_expr_rhs (expr_p, from_p, to_p, pre_p, post_p,
-				  want_value);
+                  want_value);
   if (ret != GS_UNHANDLED)
     return ret;
 
@@ -4303,14 +4381,14 @@
       tree size = TREE_OPERAND (*from_p, 1);
 
       if (TREE_CODE (from) == CONSTRUCTOR)
-	return gimplify_modify_expr_to_memset (expr_p, size, want_value, pre_p);
+    return gimplify_modify_expr_to_memset (expr_p, size, want_value, pre_p);
 
       if (is_gimple_addressable (from))
-	{
-	  *from_p = from;
-	  return gimplify_modify_expr_to_memcpy (expr_p, size, want_value,
-	      					 pre_p);
-	}
+    {
+      *from_p = from;
+      return gimplify_modify_expr_to_memcpy (expr_p, size, want_value,
+                             pre_p);
+    }
     }
 
   /* Transform partial stores to non-addressable complex variables into
@@ -4330,8 +4408,8 @@
       && !DECL_IGNORED_P (*to_p))
     {
       if (!DECL_NAME (*from_p) && DECL_NAME (*to_p))
-	DECL_NAME (*from_p)
-	  = create_tmp_var_name (IDENTIFIER_POINTER (DECL_NAME (*to_p)));
+    DECL_NAME (*from_p)
+      = create_tmp_var_name (IDENTIFIER_POINTER (DECL_NAME (*to_p)));
       DECL_DEBUG_EXPR_IS_FROM (*from_p) = 1;
       SET_DECL_DEBUG_EXPR (*from_p, *to_p);
    }
@@ -4339,19 +4417,22 @@
   if (TREE_CODE (*from_p) == CALL_EXPR)
     {
       /* Since the RHS is a CALL_EXPR, we need to create a GIMPLE_CALL
-	 instead of a GIMPLE_ASSIGN.  */
+     instead of a GIMPLE_ASSIGN.  */
       assign = gimple_build_call_from_tree (*from_p);
       gimple_call_set_lhs (assign, *to_p);
     }
   else
-    assign = gimple_build_assign (*to_p, *from_p);
+    {
+      assign = gimple_build_assign (*to_p, *from_p);
+      gimple_set_location (assign, EXPR_LOCATION (*expr_p));
+    }
 
   gimplify_seq_add_stmt (pre_p, assign);
 
   if (gimplify_ctxp->into_ssa && is_gimple_reg (*to_p))
     {
       /* If we've somehow already got an SSA_NAME on the LHS, then
-	 we've probably modified it twice.  Not good.  */
+     we've probably modified it twice.  Not good.  */
       gcc_assert (TREE_CODE (*to_p) != SSA_NAME);
       *to_p = make_ssa_name (*to_p, assign);
       gimple_set_lhs (assign, *to_p);
@@ -4377,14 +4458,15 @@
   tree op0 = TREE_OPERAND (*expr_p, 0);
   tree op1 = TREE_OPERAND (*expr_p, 1);
   tree t, arg, dest, src;
+  location_t loc = EXPR_LOCATION (*expr_p);
 
   arg = TYPE_SIZE_UNIT (TREE_TYPE (op0));
   arg = unshare_expr (arg);
   arg = SUBSTITUTE_PLACEHOLDER_IN_EXPR (arg, op0);
-  src = build_fold_addr_expr (op1);
-  dest = build_fold_addr_expr (op0);
+  src = build_fold_addr_expr_loc (loc, op1);
+  dest = build_fold_addr_expr_loc (loc, op0);
   t = implicit_built_in_decls[BUILT_IN_MEMCMP];
-  t = build_call_expr (t, 3, dest, src, arg);
+  t = build_call_expr_loc (loc, t, 3, dest, src, arg);
   *expr_p
     = build2 (TREE_CODE (*expr_p), TREE_TYPE (*expr_p), t, integer_zero_node);
 
@@ -4397,17 +4479,18 @@
 static enum gimplify_status
 gimplify_scalar_mode_aggregate_compare (tree *expr_p)
 {
+  location_t loc = EXPR_LOCATION (*expr_p);
   tree op0 = TREE_OPERAND (*expr_p, 0);
   tree op1 = TREE_OPERAND (*expr_p, 1);
 
   tree type = TREE_TYPE (op0);
   tree scalar_type = lang_hooks.types.type_for_mode (TYPE_MODE (type), 1);
 
-  op0 = fold_build1 (VIEW_CONVERT_EXPR, scalar_type, op0);
-  op1 = fold_build1 (VIEW_CONVERT_EXPR, scalar_type, op1);
+  op0 = fold_build1_loc (loc, VIEW_CONVERT_EXPR, scalar_type, op0);
+  op1 = fold_build1_loc (loc, VIEW_CONVERT_EXPR, scalar_type, op1);
 
   *expr_p
-    = fold_build2 (TREE_CODE (*expr_p), TREE_TYPE (*expr_p), op0, op1);
+    = fold_build2_loc (loc, TREE_CODE (*expr_p), TREE_TYPE (*expr_p), op0, op1);
 
   return GS_OK;
 }
@@ -4417,22 +4500,22 @@
 
     Expressions of the form 'a && b' are gimplified to:
 
-	a && b ? true : false
-
-    gimplify_cond_expr will do the rest.
-
-    PRE_P points to the list where side effects that must happen before
-	*EXPR_P should be stored.  */
+    a && b ? true : false
+
+    LOCUS is the source location to be put on the generated COND_EXPR.
+    gimplify_cond_expr will do the rest.  */
 
 static enum gimplify_status
-gimplify_boolean_expr (tree *expr_p)
+gimplify_boolean_expr (tree *expr_p, location_t locus)
 {
   /* Preserve the original type of the expression.  */
   tree type = TREE_TYPE (*expr_p);
 
   *expr_p = build3 (COND_EXPR, type, *expr_p,
-		    fold_convert (type, boolean_true_node),
-		    fold_convert (type, boolean_false_node));
+            fold_convert_loc (locus, type, boolean_true_node),
+            fold_convert_loc (locus, type, boolean_false_node));
+
+  SET_EXPR_LOCATION (*expr_p, locus);
 
   return GS_OK;
 }
@@ -4456,9 +4539,9 @@
       tree *sub_p = &TREE_OPERAND (t, 0);
 
       if (TREE_CODE (*sub_p) == COMPOUND_EXPR)
-	gimplify_compound_expr (sub_p, pre_p, false);
+    gimplify_compound_expr (sub_p, pre_p, false);
       else
-	gimplify_stmt (sub_p, pre_p);
+    gimplify_stmt (sub_p, pre_p);
 
       t = TREE_OPERAND (t, 1);
     }
@@ -4495,16 +4578,16 @@
   if (!SAVE_EXPR_RESOLVED_P (*expr_p))
     {
       /* The operand may be a void-valued expression such as SAVE_EXPRs
-	 generated by the Java frontend for class initialization.  It is
-	 being executed only for its side-effects.  */
+     generated by the Java frontend for class initialization.  It is
+     being executed only for its side-effects.  */
       if (TREE_TYPE (val) == void_type_node)
-	{
-	  ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
-			       is_gimple_stmt, fb_none);
-	  val = NULL;
-	}
+    {
+      ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
+                   is_gimple_stmt, fb_none);
+      val = NULL;
+    }
       else
-	val = get_initialized_tmp_var (val, pre_p, post_p);
+    val = get_initialized_tmp_var (val, pre_p, post_p);
 
       TREE_OPERAND (*expr_p, 0) = val;
       SAVE_EXPR_RESOLVED_P (*expr_p) = 1;
@@ -4518,15 +4601,15 @@
 /*  Re-write the ADDR_EXPR node pointed to by EXPR_P
 
       unary_expr
-	      : ...
-	      | '&' varname
-	      ...
+          : ...
+          | '&' varname
+          ...
 
     PRE_P points to the list where side effects that must happen before
-	*EXPR_P should be stored.
+    *EXPR_P should be stored.
 
     POST_P points to the list where side effects that must happen after
-	*EXPR_P should be stored.  */
+    *EXPR_P should be stored.  */
 
 static enum gimplify_status
 gimplify_addr_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
@@ -4534,6 +4617,7 @@
   tree expr = *expr_p;
   tree op0 = TREE_OPERAND (expr, 0);
   enum gimplify_status ret;
+  location_t loc = EXPR_LOCATION (*expr_p);
 
   switch (TREE_CODE (op0))
     {
@@ -4541,21 +4625,21 @@
     case MISALIGNED_INDIRECT_REF:
     do_indirect_ref:
       /* Check if we are dealing with an expression of the form '&*ptr'.
-	 While the front end folds away '&*ptr' into 'ptr', these
-	 expressions may be generated internally by the compiler (e.g.,
-	 builtins like __builtin_va_end).  */
+     While the front end folds away '&*ptr' into 'ptr', these
+     expressions may be generated internally by the compiler (e.g.,
+     builtins like __builtin_va_end).  */
       /* Caution: the silent array decomposition semantics we allow for
-	 ADDR_EXPR means we can't always discard the pair.  */
+     ADDR_EXPR means we can't always discard the pair.  */
       /* Gimplification of the ADDR_EXPR operand may drop
-	 cv-qualification conversions, so make sure we add them if
-	 needed.  */
+     cv-qualification conversions, so make sure we add them if
+     needed.  */
       {
-	tree op00 = TREE_OPERAND (op0, 0);
-	tree t_expr = TREE_TYPE (expr);
-	tree t_op00 = TREE_TYPE (op00);
+    tree op00 = TREE_OPERAND (op0, 0);
+    tree t_expr = TREE_TYPE (expr);
+    tree t_op00 = TREE_TYPE (op00);
 
         if (!useless_type_conversion_p (t_expr, t_op00))
-	  op00 = fold_convert (TREE_TYPE (expr), op00);
+      op00 = fold_convert_loc (loc, TREE_TYPE (expr), op00);
         *expr_p = op00;
         ret = GS_OK;
       }
@@ -4563,56 +4647,62 @@
 
     case VIEW_CONVERT_EXPR:
       /* Take the address of our operand and then convert it to the type of
-	 this ADDR_EXPR.
-
-	 ??? The interactions of VIEW_CONVERT_EXPR and aliasing is not at
-	 all clear.  The impact of this transformation is even less clear.  */
+     this ADDR_EXPR.
+
+     ??? The interactions of VIEW_CONVERT_EXPR and aliasing is not at
+     all clear.  The impact of this transformation is even less clear.  */
 
       /* If the operand is a useless conversion, look through it.  Doing so
-	 guarantees that the ADDR_EXPR and its operand will remain of the
-	 same type.  */
+     guarantees that the ADDR_EXPR and its operand will remain of the
+     same type.  */
       if (tree_ssa_useless_type_conversion (TREE_OPERAND (op0, 0)))
-	op0 = TREE_OPERAND (op0, 0);
-
-      *expr_p = fold_convert (TREE_TYPE (expr),
-			      build_fold_addr_expr (TREE_OPERAND (op0, 0)));
+    op0 = TREE_OPERAND (op0, 0);
+
+      *expr_p = fold_convert_loc (loc, TREE_TYPE (expr),
+                  build_fold_addr_expr_loc (loc,
+                            TREE_OPERAND (op0, 0)));
       ret = GS_OK;
       break;
 
     default:
       /* We use fb_either here because the C frontend sometimes takes
-	 the address of a call that returns a struct; see
-	 gcc.dg/c99-array-lval-1.c.  The gimplifier will correctly make
-	 the implied temporary explicit.  */
-
-      /* Mark the RHS addressable.  */
+     the address of a call that returns a struct; see
+     gcc.dg/c99-array-lval-1.c.  The gimplifier will correctly make
+     the implied temporary explicit.  */
+
+      /* Make the operand addressable.  */
       ret = gimplify_expr (&TREE_OPERAND (expr, 0), pre_p, post_p,
-			   is_gimple_addressable, fb_either);
+               is_gimple_addressable, fb_either);
       if (ret == GS_ERROR)
-	break;
-
-      /* We cannot rely on making the RHS addressable if it is
-	 a temporary created by gimplification.  In this case create a
-	 new temporary that is initialized by a copy (which will
-	 become a store after we mark it addressable).
-	 This mostly happens if the frontend passed us something that
-	 it could not mark addressable yet, like a fortran
-	 pass-by-reference parameter (int) floatvar.  */
-      if (is_gimple_formal_tmp_var (TREE_OPERAND (expr, 0)))
-	TREE_OPERAND (expr, 0)
-	  = get_initialized_tmp_var (TREE_OPERAND (expr, 0), pre_p, post_p);
+    break;
+
+      /* Then mark it.  Beware that it may not be possible to do so directly
+     if a temporary has been created by the gimplification.  */
+      prepare_gimple_addressable (&TREE_OPERAND (expr, 0), pre_p);
 
       op0 = TREE_OPERAND (expr, 0);
 
       /* For various reasons, the gimplification of the expression
-	 may have made a new INDIRECT_REF.  */
+     may have made a new INDIRECT_REF.  */
       if (TREE_CODE (op0) == INDIRECT_REF)
-	goto do_indirect_ref;
+    goto do_indirect_ref;
+
+      mark_addressable (TREE_OPERAND (expr, 0));
+
+      /* The FEs may end up building ADDR_EXPRs early on a decl with
+     an incomplete type.  Re-build ADDR_EXPRs in canonical form
+     here.  */
+      if (!types_compatible_p (TREE_TYPE (op0), TREE_TYPE (TREE_TYPE (expr))))
+    *expr_p = build_fold_addr_expr (op0);
 
       /* Make sure TREE_CONSTANT and TREE_SIDE_EFFECTS are set properly.  */
-      recompute_tree_invariant_for_addr_expr (expr);
-
-      mark_addressable (TREE_OPERAND (expr, 0));
+      recompute_tree_invariant_for_addr_expr (*expr_p);
+
+      /* If we re-built the ADDR_EXPR add a conversion to the original type
+         if required.  */
+      if (!useless_type_conversion_p (TREE_TYPE (expr), TREE_TYPE (*expr_p)))
+    *expr_p = fold_convert (TREE_TYPE (expr), *expr_p);
+
       break;
     }
 
@@ -4637,13 +4727,14 @@
   VEC(tree, gc) *inputs;
   VEC(tree, gc) *outputs;
   VEC(tree, gc) *clobbers;
+  VEC(tree, gc) *labels;
   tree link_next;
-  
+
   expr = *expr_p;
   noutputs = list_length (ASM_OUTPUTS (expr));
   oconstraints = (const char **) alloca ((noutputs) * sizeof (const char *));
 
-  inputs = outputs = clobbers = NULL;
+  inputs = outputs = clobbers = labels = NULL;
 
   ret = GS_ALL_DONE;
   link_next = NULL_TREE;
@@ -4655,126 +4746,126 @@
       link_next = TREE_CHAIN (link);
 
       oconstraints[i]
-	= constraint
-	= TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
+    = constraint
+    = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
       constraint_len = strlen (constraint);
       if (constraint_len == 0)
         continue;
 
       ok = parse_output_constraint (&constraint, i, 0, 0,
-				    &allows_mem, &allows_reg, &is_inout);
+                    &allows_mem, &allows_reg, &is_inout);
       if (!ok)
-	{
-	  ret = GS_ERROR;
-	  is_inout = false;
-	}
+    {
+      ret = GS_ERROR;
+      is_inout = false;
+    }
 
       if (!allows_reg && allows_mem)
-	mark_addressable (TREE_VALUE (link));
+    mark_addressable (TREE_VALUE (link));
 
       tret = gimplify_expr (&TREE_VALUE (link), pre_p, post_p,
-			    is_inout ? is_gimple_min_lval : is_gimple_lvalue,
-			    fb_lvalue | fb_mayfail);
+                is_inout ? is_gimple_min_lval : is_gimple_lvalue,
+                fb_lvalue | fb_mayfail);
       if (tret == GS_ERROR)
-	{
-	  error ("invalid lvalue in asm output %d", i);
-	  ret = tret;
-	}
+    {
+      error ("invalid lvalue in asm output %d", i);
+      ret = tret;
+    }
 
       VEC_safe_push (tree, gc, outputs, link);
       TREE_CHAIN (link) = NULL_TREE;
 
       if (is_inout)
-	{
-	  /* An input/output operand.  To give the optimizers more
-	     flexibility, split it into separate input and output
- 	     operands.  */
-	  tree input;
-	  char buf[10];
-
-	  /* Turn the in/out constraint into an output constraint.  */
-	  char *p = xstrdup (constraint);
-	  p[0] = '=';
-	  TREE_VALUE (TREE_PURPOSE (link)) = build_string (constraint_len, p);
-
-	  /* And add a matching input constraint.  */
-	  if (allows_reg)
-	    {
-	      sprintf (buf, "%d", i);
-
-	      /* If there are multiple alternatives in the constraint,
-		 handle each of them individually.  Those that allow register
-		 will be replaced with operand number, the others will stay
-		 unchanged.  */
-	      if (strchr (p, ',') != NULL)
-		{
-		  size_t len = 0, buflen = strlen (buf);
-		  char *beg, *end, *str, *dst;
-
-		  for (beg = p + 1;;)
-		    {
-		      end = strchr (beg, ',');
-		      if (end == NULL)
-			end = strchr (beg, '\0');
-		      if ((size_t) (end - beg) < buflen)
-			len += buflen + 1;
-		      else
-			len += end - beg + 1;
-		      if (*end)
-			beg = end + 1;
-		      else
-			break;
-		    }
-
-		  str = (char *) alloca (len);
-		  for (beg = p + 1, dst = str;;)
-		    {
-		      const char *tem;
-		      bool mem_p, reg_p, inout_p;
-
-		      end = strchr (beg, ',');
-		      if (end)
-			*end = '\0';
-		      beg[-1] = '=';
-		      tem = beg - 1;
-		      parse_output_constraint (&tem, i, 0, 0,
-					       &mem_p, &reg_p, &inout_p);
-		      if (dst != str)
-			*dst++ = ',';
-		      if (reg_p)
-			{
-			  memcpy (dst, buf, buflen);
-			  dst += buflen;
-			}
-		      else
-			{
-			  if (end)
-			    len = end - beg;
-			  else
-			    len = strlen (beg);
-			  memcpy (dst, beg, len);
-			  dst += len;
-			}
-		      if (end)
-			beg = end + 1;
-		      else
-			break;
-		    }
-		  *dst = '\0';
-		  input = build_string (dst - str, str);
-		}
-	      else
-		input = build_string (strlen (buf), buf);
-	    }
-	  else
-	    input = build_string (constraint_len - 1, constraint + 1);
-
-	  free (p);
-
-	  input = build_tree_list (build_tree_list (NULL_TREE, input),
-				   unshare_expr (TREE_VALUE (link)));
-	  ASM_INPUTS (expr) = chainon (ASM_INPUTS (expr), input);
-	}
+    {
+      /* An input/output operand.  To give the optimizers more
+         flexibility, split it into separate input and output
+         operands.  */
+      tree input;
+      char buf[10];
+
+      /* Turn the in/out constraint into an output constraint.  */
+      char *p = xstrdup (constraint);
+      p[0] = '=';
+      TREE_VALUE (TREE_PURPOSE (link)) = build_string (constraint_len, p);
+
+      /* And add a matching input constraint.  */
+      if (allows_reg)
+        {
+          sprintf (buf, "%d", i);
+
+          /* If there are multiple alternatives in the constraint,
+         handle each of them individually.  Those that allow register
+         will be replaced with operand number, the others will stay
+         unchanged.  */
+          if (strchr (p, ',') != NULL)
+        {
+          size_t len = 0, buflen = strlen (buf);
+          char *beg, *end, *str, *dst;
+
+          for (beg = p + 1;;)
+            {
+              end = strchr (beg, ',');
+              if (end == NULL)
+            end = strchr (beg, '\0');
+              if ((size_t) (end - beg) < buflen)
+            len += buflen + 1;
+              else
+            len += end - beg + 1;
+              if (*end)
+            beg = end + 1;
+              else
+            break;
+            }
+
+          str = (char *) alloca (len);
+          for (beg = p + 1, dst = str;;)
+            {
+              const char *tem;
+              bool mem_p, reg_p, inout_p;
+
+              end = strchr (beg, ',');
+              if (end)
+            *end = '\0';
+              beg[-1] = '=';
+              tem = beg - 1;
+              parse_output_constraint (&tem, i, 0, 0,
+                           &mem_p, &reg_p, &inout_p);
+              if (dst != str)
+            *dst++ = ',';
+              if (reg_p)
+            {
+              memcpy (dst, buf, buflen);
+              dst += buflen;
+            }
+              else
+            {
+              if (end)
+                len = end - beg;
+              else
+                len = strlen (beg);
+              memcpy (dst, beg, len);
+              dst += len;
+            }
+              if (end)
+            beg = end + 1;
+              else
+            break;
+            }
+          *dst = '\0';
+          input = build_string (dst - str, str);
+        }
+          else
+        input = build_string (strlen (buf), buf);
+        }
+      else
+        input = build_string (constraint_len - 1, constraint + 1);
+
+      free (p);
+
+      input = build_tree_list (build_tree_list (NULL_TREE, input),
+                   unshare_expr (TREE_VALUE (link)));
+      ASM_INPUTS (expr) = chainon (ASM_INPUTS (expr), input);
+    }
     }
 
   link_next = NULL_TREE;
@@ -4783,57 +4874,64 @@
       link_next = TREE_CHAIN (link);
       constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (link)));
       parse_input_constraint (&constraint, 0, 0, noutputs, 0,
-			      oconstraints, &allows_mem, &allows_reg);
+                  oconstraints, &allows_mem, &allows_reg);
 
       /* If we can't make copies, we can only accept memory.  */
       if (TREE_ADDRESSABLE (TREE_TYPE (TREE_VALUE (link))))
-	{
-	  if (allows_mem)
-	    allows_reg = 0;
-	  else
-	    {
-	      error ("impossible constraint in %<asm%>");
-	      error ("non-memory input %d must stay in memory", i);
-	      return GS_ERROR;
-	    }
-	}
+    {
+      if (allows_mem)
+        allows_reg = 0;
+      else
+        {
+          error ("impossible constraint in %<asm%>");
+          error ("non-memory input %d must stay in memory", i);
+          return GS_ERROR;
+        }
+    }
 
       /* If the operand is a memory input, it should be an lvalue.  */
       if (!allows_reg && allows_mem)
-	{
-	  tret = gimplify_expr (&TREE_VALUE (link), pre_p, post_p,
-				is_gimple_lvalue, fb_lvalue | fb_mayfail);
-	  mark_addressable (TREE_VALUE (link));
-	  if (tret == GS_ERROR)
-	    {
-	      if (EXPR_HAS_LOCATION (TREE_VALUE (link)))
-	        input_location = EXPR_LOCATION (TREE_VALUE (link));
-	      error ("memory input %d is not directly addressable", i);
-	      ret = tret;
-	    }
-	}
+    {
+      tret = gimplify_expr (&TREE_VALUE (link), pre_p, post_p,
+                is_gimple_lvalue, fb_lvalue | fb_mayfail);
+      mark_addressable (TREE_VALUE (link));
+      if (tret == GS_ERROR)
+        {
+          if (EXPR_HAS_LOCATION (TREE_VALUE (link)))
+            input_location = EXPR_LOCATION (TREE_VALUE (link));
+          error ("memory input %d is not directly addressable", i);
+          ret = tret;
+        }
+    }
       else
-	{
-	  tret = gimplify_expr (&TREE_VALUE (link), pre_p, post_p,
-				is_gimple_asm_val, fb_rvalue);
-	  if (tret == GS_ERROR)
-	    ret = tret;
-	}
+    {
+      tret = gimplify_expr (&TREE_VALUE (link), pre_p, post_p,
+                is_gimple_asm_val, fb_rvalue);
+      if (tret == GS_ERROR)
+        ret = tret;
+    }
 
       TREE_CHAIN (link) = NULL_TREE;
       VEC_safe_push (tree, gc, inputs, link);
     }
-  
+
   for (link = ASM_CLOBBERS (expr); link; ++i, link = TREE_CHAIN (link))
-      VEC_safe_push (tree, gc, clobbers, link);
-    
-  stmt = gimple_build_asm_vec (TREE_STRING_POINTER (ASM_STRING (expr)),
-                               inputs, outputs, clobbers);
-
-  gimple_asm_set_volatile (stmt, ASM_VOLATILE_P (expr));
-  gimple_asm_set_input (stmt, ASM_INPUT_P (expr));
-
-  gimplify_seq_add_stmt (pre_p, stmt);
+    VEC_safe_push (tree, gc, clobbers, link);
+
+  for (link = ASM_LABELS (expr); link; ++i, link = TREE_CHAIN (link))
+    VEC_safe_push (tree, gc, labels, link);
+
+  /* Do not add ASMs with errors to the gimple IL stream.  */
+  if (ret != GS_ERROR)
+    {
+      stmt = gimple_build_asm_vec (TREE_STRING_POINTER (ASM_STRING (expr)),
+                   inputs, outputs, clobbers, labels);
+
+      gimple_asm_set_volatile (stmt, ASM_VOLATILE_P (expr));
+      gimple_asm_set_input (stmt, ASM_INPUT_P (expr));
+
+      gimplify_seq_add_stmt (pre_p, stmt);
+    }
 
   return ret;
 }
@@ -4878,38 +4976,38 @@
       gimple wce = gsi_stmt (iter);
 
       if (gimple_code (wce) == GIMPLE_WITH_CLEANUP_EXPR)
-	{
-	  if (gsi_one_before_end_p (iter))
-	    {
+    {
+      if (gsi_one_before_end_p (iter))
+        {
               /* Note that gsi_insert_seq_before and gsi_remove do not
                  scan operands, unlike some other sequence mutators.  */
-	      gsi_insert_seq_before_without_update (&iter,
+          gsi_insert_seq_before_without_update (&iter,
                                                     gimple_wce_cleanup (wce),
                                                     GSI_SAME_STMT);
-	      gsi_remove (&iter, true);
-	      break;
-	    }
-	  else
-	    {
-	      gimple gtry;
-	      gimple_seq seq;
-	      enum gimple_try_flags kind;
-
-	      if (gimple_wce_cleanup_eh_only (wce))
-		kind = GIMPLE_TRY_CATCH;
-	      else
-		kind = GIMPLE_TRY_FINALLY;
-	      seq = gsi_split_seq_after (iter);
-
-	      gtry = gimple_build_try (seq, gimple_wce_cleanup (wce), kind);
+          gsi_remove (&iter, true);
+          break;
+        }
+      else
+        {
+          gimple gtry;
+          gimple_seq seq;
+          enum gimple_try_flags kind;
+
+          if (gimple_wce_cleanup_eh_only (wce))
+        kind = GIMPLE_TRY_CATCH;
+          else
+        kind = GIMPLE_TRY_FINALLY;
+          seq = gsi_split_seq_after (iter);
+
+          gtry = gimple_build_try (seq, gimple_wce_cleanup (wce), kind);
               /* Do not use gsi_replace here, as it may scan operands.
                  We want to do a simple structural modification only.  */
               *gsi_stmt_ptr (&iter) = gtry;
-	      iter = gsi_start (seq);
-	    }
-	}
+          iter = gsi_start (seq);
+        }
+    }
       else
-	gsi_next (&iter);
+    gsi_next (&iter);
     }
 
   gimplify_seq_add_seq (pre_p, body_sequence);
@@ -4943,24 +5041,24 @@
   if (gimple_conditional_context ())
     {
       /* If we're in a conditional context, this is more complex.  We only
-	 want to run the cleanup if we actually ran the initialization that
-	 necessitates it, but we want to run it after the end of the
-	 conditional context.  So we wrap the try/finally around the
-	 condition and use a flag to determine whether or not to actually
-	 run the destructor.  Thus
-
-	   test ? f(A()) : 0
-
-	 becomes (approximately)
-
-	   flag = 0;
-	   try {
-	     if (test) { A::A(temp); flag = 1; val = f(temp); }
-	     else { val = 0; }
-	   } finally {
-	     if (flag) A::~A(temp);
-	   }
-	   val
+     want to run the cleanup if we actually ran the initialization that
+     necessitates it, but we want to run it after the end of the
+     conditional context.  So we wrap the try/finally around the
+     condition and use a flag to determine whether or not to actually
+     run the destructor.  Thus
+
+       test ? f(A()) : 0
+
+     becomes (approximately)
+
+       flag = 0;
+       try {
+         if (test) { A::A(temp); flag = 1; val = f(temp); }
+         else { val = 0; }
+       } finally {
+         if (flag) A::~A(temp);
+       }
+       val
       */
       tree flag = create_tmp_var (boolean_type_node, "cleanup");
       gimple ffalse = gimple_build_assign (flag, boolean_false_node);
@@ -4975,8 +5073,8 @@
       gimplify_seq_add_stmt (pre_p, ftrue);
 
       /* Because of this manipulation, and the EH edges that jump
-	 threading cannot redirect, the temporary (VAR) will appear
-	 to be used uninitialized.  Don't warn.  */
+     threading cannot redirect, the temporary (VAR) will appear
+     to be used uninitialized.  Don't warn.  */
       TREE_NO_WARNING (var) = 1;
     }
   else
@@ -5001,41 +5099,41 @@
   if (init)
     {
       /* TARGET_EXPR temps aren't part of the enclosing block, so add it
-	 to the temps list.  Handle also variable length TARGET_EXPRs.  */
+     to the temps list.  Handle also variable length TARGET_EXPRs.  */
       if (TREE_CODE (DECL_SIZE (temp)) != INTEGER_CST)
-	{
-	  if (!TYPE_SIZES_GIMPLIFIED (TREE_TYPE (temp)))
-	    gimplify_type_sizes (TREE_TYPE (temp), pre_p);
-	  gimplify_vla_decl (temp, pre_p);
-	}
+    {
+      if (!TYPE_SIZES_GIMPLIFIED (TREE_TYPE (temp)))
+        gimplify_type_sizes (TREE_TYPE (temp), pre_p);
+      gimplify_vla_decl (temp, pre_p);
+    }
       else
-	gimple_add_tmp_var (temp);
+    gimple_add_tmp_var (temp);
 
       /* If TARGET_EXPR_INITIAL is void, then the mere evaluation of the
-	 expression is supposed to initialize the slot.  */
+     expression is supposed to initialize the slot.  */
       if (VOID_TYPE_P (TREE_TYPE (init)))
-	ret = gimplify_expr (&init, pre_p, post_p, is_gimple_stmt, fb_none);
+    ret = gimplify_expr (&init, pre_p, post_p, is_gimple_stmt, fb_none);
       else
-	{
-	  tree init_expr = build2 (INIT_EXPR, void_type_node, temp, init);
-	  init = init_expr;
-	  ret = gimplify_expr (&init, pre_p, post_p, is_gimple_stmt, fb_none);
-	  init = NULL;
-	  ggc_free (init_expr);
-	}
+    {
+      tree init_expr = build2 (INIT_EXPR, void_type_node, temp, init);
+      init = init_expr;
+      ret = gimplify_expr (&init, pre_p, post_p, is_gimple_stmt, fb_none);
+      init = NULL;
+      ggc_free (init_expr);
+    }
       if (ret == GS_ERROR)
-	{
-	  /* PR c++/28266 Make sure this is expanded only once. */
-	  TARGET_EXPR_INITIAL (targ) = NULL_TREE;
-	  return GS_ERROR;
-	}
+    {
+      /* PR c++/28266 Make sure this is expanded only once. */
+      TARGET_EXPR_INITIAL (targ) = NULL_TREE;
+      return GS_ERROR;
+    }
       if (init)
-	gimplify_and_add (init, pre_p);
+    gimplify_and_add (init, pre_p);
 
       /* If needed, push the cleanup for the temp.  */
       if (TARGET_EXPR_CLEANUP (targ))
-	gimple_push_cleanup (temp, TARGET_EXPR_CLEANUP (targ),
-			     CLEANUP_EH_ONLY (targ), pre_p);
+    gimple_push_cleanup (temp, TARGET_EXPR_CLEANUP (targ),
+                 CLEANUP_EH_ONLY (targ), pre_p);
 
       /* Only expand this once.  */
       TREE_OPERAND (targ, 3) = init;
@@ -5087,14 +5185,14 @@
     {
       n = splay_tree_lookup (ctx->variables, (splay_tree_key)decl);
       if (n != NULL)
-	{
-	  if (n->value & GOVD_SHARED)
-	    n->value = GOVD_FIRSTPRIVATE | (n->value & GOVD_SEEN);
-	  else
-	    return;
-	}
+    {
+      if (n->value & GOVD_SHARED)
+        n->value = GOVD_FIRSTPRIVATE | (n->value & GOVD_SEEN);
+      else
+        return;
+    }
       else if (ctx->region_type != ORT_WORKSHARE)
-	omp_add_variable (ctx, decl, GOVD_FIRSTPRIVATE);
+    omp_add_variable (ctx, decl, GOVD_FIRSTPRIVATE);
 
       ctx = ctx->outer_context;
     }
@@ -5133,13 +5231,13 @@
     case UNION_TYPE:
     case QUAL_UNION_TYPE:
       {
-	tree field;
-	for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
-	  if (TREE_CODE (field) == FIELD_DECL)
-	    {
-	      omp_firstprivatize_variable (ctx, DECL_FIELD_OFFSET (field));
-	      omp_firstprivatize_type_sizes (ctx, TREE_TYPE (field));
-	    }
+    tree field;
+    for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
+      if (TREE_CODE (field) == FIELD_DECL)
+        {
+          omp_firstprivatize_variable (ctx, DECL_FIELD_OFFSET (field));
+          omp_firstprivatize_type_sizes (ctx, TREE_TYPE (field));
+        }
       }
       break;
 
@@ -5179,59 +5277,59 @@
   if (n != NULL)
     {
       /* We shouldn't be re-adding the decl with the same data
-	 sharing class.  */
+     sharing class.  */
       gcc_assert ((n->value & GOVD_DATA_SHARE_CLASS & flags) == 0);
       /* The only combination of data sharing classes we should see is
-	 FIRSTPRIVATE and LASTPRIVATE.  */
+     FIRSTPRIVATE and LASTPRIVATE.  */
       nflags = n->value | flags;
       gcc_assert ((nflags & GOVD_DATA_SHARE_CLASS)
-		  == (GOVD_FIRSTPRIVATE | GOVD_LASTPRIVATE));
+          == (GOVD_FIRSTPRIVATE | GOVD_LASTPRIVATE));
       n->value = nflags;
       return;
     }
 
   /* When adding a variable-sized variable, we have to handle all sorts
-     of additional bits of data: the pointer replacement variable, and 
+     of additional bits of data: the pointer replacement variable, and
      the parameters of the type.  */
   if (DECL_SIZE (decl) && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
     {
       /* Add the pointer replacement variable as PRIVATE if the variable
-	 replacement is private, else FIRSTPRIVATE since we'll need the
-	 address of the original variable either for SHARED, or for the
-	 copy into or out of the context.  */
+     replacement is private, else FIRSTPRIVATE since we'll need the
+     address of the original variable either for SHARED, or for the
+     copy into or out of the context.  */
       if (!(flags & GOVD_LOCAL))
-	{
-	  nflags = flags & GOVD_PRIVATE ? GOVD_PRIVATE : GOVD_FIRSTPRIVATE;
-	  nflags |= flags & GOVD_SEEN;
-	  t = DECL_VALUE_EXPR (decl);
-	  gcc_assert (TREE_CODE (t) == INDIRECT_REF);
-	  t = TREE_OPERAND (t, 0);
-	  gcc_assert (DECL_P (t));
-	  omp_add_variable (ctx, t, nflags);
-	}
+    {
+      nflags = flags & GOVD_PRIVATE ? GOVD_PRIVATE : GOVD_FIRSTPRIVATE;
+      nflags |= flags & GOVD_SEEN;
+      t = DECL_VALUE_EXPR (decl);
+      gcc_assert (TREE_CODE (t) == INDIRECT_REF);
+      t = TREE_OPERAND (t, 0);
+      gcc_assert (DECL_P (t));
+      omp_add_variable (ctx, t, nflags);
+    }
 
       /* Add all of the variable and type parameters (which should have
-	 been gimplified to a formal temporary) as FIRSTPRIVATE.  */
+     been gimplified to a formal temporary) as FIRSTPRIVATE.  */
       omp_firstprivatize_variable (ctx, DECL_SIZE_UNIT (decl));
       omp_firstprivatize_variable (ctx, DECL_SIZE (decl));
       omp_firstprivatize_type_sizes (ctx, TREE_TYPE (decl));
 
       /* The variable-sized variable itself is never SHARED, only some form
-	 of PRIVATE.  The sharing would take place via the pointer variable
-	 which we remapped above.  */
+     of PRIVATE.  The sharing would take place via the pointer variable
+     which we remapped above.  */
       if (flags & GOVD_SHARED)
-	flags = GOVD_PRIVATE | GOVD_DEBUG_PRIVATE
-		| (flags & (GOVD_SEEN | GOVD_EXPLICIT));
-
-      /* We're going to make use of the TYPE_SIZE_UNIT at least in the 
-	 alloca statement we generate for the variable, so make sure it
-	 is available.  This isn't automatically needed for the SHARED
-	 case, since we won't be allocating local storage then.
-	 For local variables TYPE_SIZE_UNIT might not be gimplified yet,
-	 in this case omp_notice_variable will be called later
-	 on when it is gimplified.  */
+    flags = GOVD_PRIVATE | GOVD_DEBUG_PRIVATE
+        | (flags & (GOVD_SEEN | GOVD_EXPLICIT));
+
+      /* We're going to make use of the TYPE_SIZE_UNIT at least in the
+     alloca statement we generate for the variable, so make sure it
+     is available.  This isn't automatically needed for the SHARED
+     case, since we won't be allocating local storage then.
+     For local variables TYPE_SIZE_UNIT might not be gimplified yet,
+     in this case omp_notice_variable will be called later
+     on when it is gimplified.  */
       else if (! (flags & GOVD_LOCAL))
-	omp_notice_variable (ctx, TYPE_SIZE_UNIT (TREE_TYPE (decl)), true);
+    omp_notice_variable (ctx, TYPE_SIZE_UNIT (TREE_TYPE (decl)), true);
     }
   else if (lang_hooks.decls.omp_privatize_by_reference (decl))
     {
@@ -5239,13 +5337,13 @@
       omp_firstprivatize_type_sizes (ctx, TREE_TYPE (decl));
 
       /* Similar to the direct variable sized case above, we'll need the
-	 size of references being privatized.  */
+     size of references being privatized.  */
       if ((flags & GOVD_SHARED) == 0)
-	{
-	  t = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (decl)));
-	  if (TREE_CODE (t) != INTEGER_CST)
-	    omp_notice_variable (ctx, t, true);
-	}
+    {
+      t = TYPE_SIZE_UNIT (TREE_TYPE (TREE_TYPE (decl)));
+      if (TREE_CODE (t) != INTEGER_CST)
+        omp_notice_variable (ctx, t, true);
+    }
     }
 
   splay_tree_insert (ctx->variables, (splay_tree_key)decl, flags);
@@ -5271,15 +5369,15 @@
   if (is_global_var (decl))
     {
       if (DECL_THREAD_LOCAL_P (decl))
-	return false;
+    return false;
 
       if (DECL_HAS_VALUE_EXPR_P (decl))
-	{
-	  tree value = get_base_address (DECL_VALUE_EXPR (decl));
-
-	  if (value && DECL_P (value) && DECL_THREAD_LOCAL_P (value))
-	    return false;
-	}
+    {
+      tree value = get_base_address (DECL_VALUE_EXPR (decl));
+
+      if (value && DECL_P (value) && DECL_THREAD_LOCAL_P (value))
+        return false;
+    }
     }
 
   n = splay_tree_lookup (ctx->variables, (splay_tree_key)decl);
@@ -5289,69 +5387,69 @@
       struct gimplify_omp_ctx *octx;
 
       if (ctx->region_type == ORT_WORKSHARE)
-	goto do_outer;
+    goto do_outer;
 
       /* ??? Some compiler-generated variables (like SAVE_EXPRs) could be
-	 remapped firstprivate instead of shared.  To some extent this is
-	 addressed in omp_firstprivatize_type_sizes, but not effectively.  */
+     remapped firstprivate instead of shared.  To some extent this is
+     addressed in omp_firstprivatize_type_sizes, but not effectively.  */
       default_kind = ctx->default_kind;
       kind = lang_hooks.decls.omp_predetermined_sharing (decl);
       if (kind != OMP_CLAUSE_DEFAULT_UNSPECIFIED)
-	default_kind = kind;
+    default_kind = kind;
 
       switch (default_kind)
-	{
-	case OMP_CLAUSE_DEFAULT_NONE:
-	  error ("%qs not specified in enclosing parallel",
-		 IDENTIFIER_POINTER (DECL_NAME (decl)));
-	  error ("%Henclosing parallel", &ctx->location);
-	  /* FALLTHRU */
-	case OMP_CLAUSE_DEFAULT_SHARED:
-	  flags |= GOVD_SHARED;
-	  break;
-	case OMP_CLAUSE_DEFAULT_PRIVATE:
-	  flags |= GOVD_PRIVATE;
-	  break;
-	case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE:
-	  flags |= GOVD_FIRSTPRIVATE;
-	  break;
-	case OMP_CLAUSE_DEFAULT_UNSPECIFIED:
-	  /* decl will be either GOVD_FIRSTPRIVATE or GOVD_SHARED.  */
-	  gcc_assert (ctx->region_type == ORT_TASK);
-	  if (ctx->outer_context)
-	    omp_notice_variable (ctx->outer_context, decl, in_code);
-	  for (octx = ctx->outer_context; octx; octx = octx->outer_context)
-	    {
-	      splay_tree_node n2;
-
-	      n2 = splay_tree_lookup (octx->variables, (splay_tree_key) decl);
-	      if (n2 && (n2->value & GOVD_DATA_SHARE_CLASS) != GOVD_SHARED)
-		{
-		  flags |= GOVD_FIRSTPRIVATE;
-		  break;
-		}
-	      if ((octx->region_type & ORT_PARALLEL) != 0)
-		break;
-	    }
-	  if (flags & GOVD_FIRSTPRIVATE)
-	    break;
-	  if (octx == NULL
-	      && (TREE_CODE (decl) == PARM_DECL
-		  || (!is_global_var (decl)
-		      && DECL_CONTEXT (decl) == current_function_decl)))
-	    {
-	      flags |= GOVD_FIRSTPRIVATE;
-	      break;
-	    }
-	  flags |= GOVD_SHARED;
-	  break;
-	default:
-	  gcc_unreachable ();
-	}
+    {
+    case OMP_CLAUSE_DEFAULT_NONE:
+      error ("%qE not specified in enclosing parallel",
+         DECL_NAME (decl));
+      error_at (ctx->location, "enclosing parallel");
+      /* FALLTHRU */
+    case OMP_CLAUSE_DEFAULT_SHARED:
+      flags |= GOVD_SHARED;
+      break;
+    case OMP_CLAUSE_DEFAULT_PRIVATE:
+      flags |= GOVD_PRIVATE;
+      break;
+    case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE:
+      flags |= GOVD_FIRSTPRIVATE;
+      break;
+    case OMP_CLAUSE_DEFAULT_UNSPECIFIED:
+      /* decl will be either GOVD_FIRSTPRIVATE or GOVD_SHARED.  */
+      gcc_assert (ctx->region_type == ORT_TASK);
+      if (ctx->outer_context)
+        omp_notice_variable (ctx->outer_context, decl, in_code);
+      for (octx = ctx->outer_context; octx; octx = octx->outer_context)
+        {
+          splay_tree_node n2;
+
+          n2 = splay_tree_lookup (octx->variables, (splay_tree_key) decl);
+          if (n2 && (n2->value & GOVD_DATA_SHARE_CLASS) != GOVD_SHARED)
+        {
+          flags |= GOVD_FIRSTPRIVATE;
+          break;
+        }
+          if ((octx->region_type & ORT_PARALLEL) != 0)
+        break;
+        }
+      if (flags & GOVD_FIRSTPRIVATE)
+        break;
+      if (octx == NULL
+          && (TREE_CODE (decl) == PARM_DECL
+          || (!is_global_var (decl)
+              && DECL_CONTEXT (decl) == current_function_decl)))
+        {
+          flags |= GOVD_FIRSTPRIVATE;
+          break;
+        }
+      flags |= GOVD_SHARED;
+      break;
+    default:
+      gcc_unreachable ();
+    }
 
       if ((flags & GOVD_PRIVATE)
-	  && lang_hooks.decls.omp_private_outer_ref (decl))
-	flags |= GOVD_PRIVATE_OUTER_REF;
+      && lang_hooks.decls.omp_private_outer_ref (decl))
+    flags |= GOVD_PRIVATE_OUTER_REF;
 
       omp_add_variable (ctx, decl, flags);
 
@@ -5406,32 +5504,32 @@
   if (n != NULL)
     {
       if (n->value & GOVD_SHARED)
-	{
-	  if (ctx == gimplify_omp_ctxp)
-	    {
-	      error ("iteration variable %qs should be private",
-		     IDENTIFIER_POINTER (DECL_NAME (decl)));
-	      n->value = GOVD_PRIVATE;
-	      return true;
-	    }
-	  else
-	    return false;
-	}
+    {
+      if (ctx == gimplify_omp_ctxp)
+        {
+          error ("iteration variable %qE should be private",
+             DECL_NAME (decl));
+          n->value = GOVD_PRIVATE;
+          return true;
+        }
+      else
+        return false;
+    }
       else if ((n->value & GOVD_EXPLICIT) != 0
-	       && (ctx == gimplify_omp_ctxp
-		   || (ctx->region_type == ORT_COMBINED_PARALLEL
-		       && gimplify_omp_ctxp->outer_context == ctx)))
-	{
-	  if ((n->value & GOVD_FIRSTPRIVATE) != 0)
-	    error ("iteration variable %qs should not be firstprivate",
-		   IDENTIFIER_POINTER (DECL_NAME (decl)));
-	  else if ((n->value & GOVD_REDUCTION) != 0)
-	    error ("iteration variable %qs should not be reduction",
-		   IDENTIFIER_POINTER (DECL_NAME (decl)));
-	}
+           && (ctx == gimplify_omp_ctxp
+           || (ctx->region_type == ORT_COMBINED_PARALLEL
+               && gimplify_omp_ctxp->outer_context == ctx)))
+    {
+      if ((n->value & GOVD_FIRSTPRIVATE) != 0)
+        error ("iteration variable %qE should not be firstprivate",
+           DECL_NAME (decl));
+      else if ((n->value & GOVD_REDUCTION) != 0)
+        error ("iteration variable %qE should not be reduction",
+           DECL_NAME (decl));
+    }
       return (ctx == gimplify_omp_ctxp
-	      || (ctx->region_type == ORT_COMBINED_PARALLEL
-		  && gimplify_omp_ctxp->outer_context == ctx));
+          || (ctx->region_type == ORT_COMBINED_PARALLEL
+          && gimplify_omp_ctxp->outer_context == ctx));
     }
 
   if (ctx->region_type != ORT_WORKSHARE)
@@ -5454,13 +5552,13 @@
     {
       ctx = ctx->outer_context;
       if (ctx == NULL)
-	return !(is_global_var (decl)
-		 /* References might be private, but might be shared too.  */
-		 || lang_hooks.decls.omp_privatize_by_reference (decl));
+    return !(is_global_var (decl)
+         /* References might be private, but might be shared too.  */
+         || lang_hooks.decls.omp_privatize_by_reference (decl));
 
       n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl);
       if (n != NULL)
-	return (n->value & GOVD_SHARED) == 0;
+    return (n->value & GOVD_SHARED) == 0;
     }
   while (ctx->region_type == ORT_WORKSHARE);
   return false;
@@ -5471,7 +5569,7 @@
 
 static void
 gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
-			   enum omp_region_type region_type)
+               enum omp_region_type region_type)
 {
   struct gimplify_omp_ctx *ctx, *outer_ctx;
   struct gimplify_ctx gctx;
@@ -5489,142 +5587,142 @@
       tree decl;
 
       switch (OMP_CLAUSE_CODE (c))
-	{
-	case OMP_CLAUSE_PRIVATE:
-	  flags = GOVD_PRIVATE | GOVD_EXPLICIT;
-	  if (lang_hooks.decls.omp_private_outer_ref (OMP_CLAUSE_DECL (c)))
-	    {
-	      flags |= GOVD_PRIVATE_OUTER_REF;
-	      OMP_CLAUSE_PRIVATE_OUTER_REF (c) = 1;
-	    }
-	  else
-	    notice_outer = false;
-	  goto do_add;
-	case OMP_CLAUSE_SHARED:
-	  flags = GOVD_SHARED | GOVD_EXPLICIT;
-	  goto do_add;
-	case OMP_CLAUSE_FIRSTPRIVATE:
-	  flags = GOVD_FIRSTPRIVATE | GOVD_EXPLICIT;
-	  check_non_private = "firstprivate";
-	  goto do_add;
-	case OMP_CLAUSE_LASTPRIVATE:
-	  flags = GOVD_LASTPRIVATE | GOVD_SEEN | GOVD_EXPLICIT;
-	  check_non_private = "lastprivate";
-	  goto do_add;
-	case OMP_CLAUSE_REDUCTION:
-	  flags = GOVD_REDUCTION | GOVD_SEEN | GOVD_EXPLICIT;
-	  check_non_private = "reduction";
-	  goto do_add;
-
-	do_add:
-	  decl = OMP_CLAUSE_DECL (c);
-	  if (decl == error_mark_node || TREE_TYPE (decl) == error_mark_node)
-	    {
-	      remove = true;
-	      break;
-	    }
-	  omp_add_variable (ctx, decl, flags);
-	  if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION
-	      && OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
-	    {
-	      omp_add_variable (ctx, OMP_CLAUSE_REDUCTION_PLACEHOLDER (c),
-				GOVD_LOCAL | GOVD_SEEN);
-	      gimplify_omp_ctxp = ctx;
-	      push_gimplify_context (&gctx);
-
-	      OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c) = gimple_seq_alloc ();
-	      OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c) = gimple_seq_alloc ();
-
-	      gimplify_and_add (OMP_CLAUSE_REDUCTION_INIT (c),
-		  		&OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c));
-	      pop_gimplify_context
-		(gimple_seq_first_stmt (OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c)));
-	      push_gimplify_context (&gctx);
-	      gimplify_and_add (OMP_CLAUSE_REDUCTION_MERGE (c),
-		  		&OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c));
-	      pop_gimplify_context 
-		(gimple_seq_first_stmt (OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c)));
-	      OMP_CLAUSE_REDUCTION_INIT (c) = NULL_TREE;
-	      OMP_CLAUSE_REDUCTION_MERGE (c) = NULL_TREE;
-
-	      gimplify_omp_ctxp = outer_ctx;
-	    }
-	  else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE
-		   && OMP_CLAUSE_LASTPRIVATE_STMT (c))
-	    {
-	      gimplify_omp_ctxp = ctx;
-	      push_gimplify_context (&gctx);
-	      if (TREE_CODE (OMP_CLAUSE_LASTPRIVATE_STMT (c)) != BIND_EXPR)
-		{
-		  tree bind = build3 (BIND_EXPR, void_type_node, NULL,
-				      NULL, NULL);
-		  TREE_SIDE_EFFECTS (bind) = 1;
-		  BIND_EXPR_BODY (bind) = OMP_CLAUSE_LASTPRIVATE_STMT (c);
-		  OMP_CLAUSE_LASTPRIVATE_STMT (c) = bind;
-		}
-	      gimplify_and_add (OMP_CLAUSE_LASTPRIVATE_STMT (c),
-				&OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c));
-	      pop_gimplify_context
-		(gimple_seq_first_stmt (OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c)));
-	      OMP_CLAUSE_LASTPRIVATE_STMT (c) = NULL_TREE;
-
-	      gimplify_omp_ctxp = outer_ctx;
-	    }
-	  if (notice_outer)
-	    goto do_notice;
-	  break;
-
-	case OMP_CLAUSE_COPYIN:
-	case OMP_CLAUSE_COPYPRIVATE:
-	  decl = OMP_CLAUSE_DECL (c);
-	  if (decl == error_mark_node || TREE_TYPE (decl) == error_mark_node)
-	    {
-	      remove = true;
-	      break;
-	    }
-	do_notice:
-	  if (outer_ctx)
-	    omp_notice_variable (outer_ctx, decl, true);
-	  if (check_non_private
-	      && region_type == ORT_WORKSHARE
-	      && omp_check_private (ctx, decl))
-	    {
-	      error ("%s variable %qs is private in outer context",
-		     check_non_private, IDENTIFIER_POINTER (DECL_NAME (decl)));
-	      remove = true;
-	    }
-	  break;
-
-	case OMP_CLAUSE_IF:
-	  OMP_CLAUSE_OPERAND (c, 0)
-	    = gimple_boolify (OMP_CLAUSE_OPERAND (c, 0));
-	  /* Fall through.  */
-
-	case OMP_CLAUSE_SCHEDULE:
-	case OMP_CLAUSE_NUM_THREADS:
-	  if (gimplify_expr (&OMP_CLAUSE_OPERAND (c, 0), pre_p, NULL,
-			     is_gimple_val, fb_rvalue) == GS_ERROR)
-	      remove = true;
-	  break;
-
-	case OMP_CLAUSE_NOWAIT:
-	case OMP_CLAUSE_ORDERED:
-	case OMP_CLAUSE_UNTIED:
-	case OMP_CLAUSE_COLLAPSE:
-	  break;
-
-	case OMP_CLAUSE_DEFAULT:
-	  ctx->default_kind = OMP_CLAUSE_DEFAULT_KIND (c);
-	  break;
-
-	default:
-	  gcc_unreachable ();
-	}
+    {
+    case OMP_CLAUSE_PRIVATE:
+      flags = GOVD_PRIVATE | GOVD_EXPLICIT;
+      if (lang_hooks.decls.omp_private_outer_ref (OMP_CLAUSE_DECL (c)))
+        {
+          flags |= GOVD_PRIVATE_OUTER_REF;
+          OMP_CLAUSE_PRIVATE_OUTER_REF (c) = 1;
+        }
+      else
+        notice_outer = false;
+      goto do_add;
+    case OMP_CLAUSE_SHARED:
+      flags = GOVD_SHARED | GOVD_EXPLICIT;
+      goto do_add;
+    case OMP_CLAUSE_FIRSTPRIVATE:
+      flags = GOVD_FIRSTPRIVATE | GOVD_EXPLICIT;
+      check_non_private = "firstprivate";
+      goto do_add;
+    case OMP_CLAUSE_LASTPRIVATE:
+      flags = GOVD_LASTPRIVATE | GOVD_SEEN | GOVD_EXPLICIT;
+      check_non_private = "lastprivate";
+      goto do_add;
+    case OMP_CLAUSE_REDUCTION:
+      flags = GOVD_REDUCTION | GOVD_SEEN | GOVD_EXPLICIT;
+      check_non_private = "reduction";
+      goto do_add;
+
+    do_add:
+      decl = OMP_CLAUSE_DECL (c);
+      if (decl == error_mark_node || TREE_TYPE (decl) == error_mark_node)
+        {
+          remove = true;
+          break;
+        }
+      omp_add_variable (ctx, decl, flags);
+      if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION
+          && OMP_CLAUSE_REDUCTION_PLACEHOLDER (c))
+        {
+          omp_add_variable (ctx, OMP_CLAUSE_REDUCTION_PLACEHOLDER (c),
+                GOVD_LOCAL | GOVD_SEEN);
+          gimplify_omp_ctxp = ctx;
+          push_gimplify_context (&gctx);
+
+          OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c) = gimple_seq_alloc ();
+          OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c) = gimple_seq_alloc ();
+
+          gimplify_and_add (OMP_CLAUSE_REDUCTION_INIT (c),
+                &OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c));
+          pop_gimplify_context
+        (gimple_seq_first_stmt (OMP_CLAUSE_REDUCTION_GIMPLE_INIT (c)));
+          push_gimplify_context (&gctx);
+          gimplify_and_add (OMP_CLAUSE_REDUCTION_MERGE (c),
+                &OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c));
+          pop_gimplify_context
+        (gimple_seq_first_stmt (OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c)));
+          OMP_CLAUSE_REDUCTION_INIT (c) = NULL_TREE;
+          OMP_CLAUSE_REDUCTION_MERGE (c) = NULL_TREE;
+
+          gimplify_omp_ctxp = outer_ctx;
+        }
+      else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE
+           && OMP_CLAUSE_LASTPRIVATE_STMT (c))
+        {
+          gimplify_omp_ctxp = ctx;
+          push_gimplify_context (&gctx);
+          if (TREE_CODE (OMP_CLAUSE_LASTPRIVATE_STMT (c)) != BIND_EXPR)
+        {
+          tree bind = build3 (BIND_EXPR, void_type_node, NULL,
+                      NULL, NULL);
+          TREE_SIDE_EFFECTS (bind) = 1;
+          BIND_EXPR_BODY (bind) = OMP_CLAUSE_LASTPRIVATE_STMT (c);
+          OMP_CLAUSE_LASTPRIVATE_STMT (c) = bind;
+        }
+          gimplify_and_add (OMP_CLAUSE_LASTPRIVATE_STMT (c),
+                &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c));
+          pop_gimplify_context
+        (gimple_seq_first_stmt (OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c)));
+          OMP_CLAUSE_LASTPRIVATE_STMT (c) = NULL_TREE;
+
+          gimplify_omp_ctxp = outer_ctx;
+        }
+      if (notice_outer)
+        goto do_notice;
+      break;
+
+    case OMP_CLAUSE_COPYIN:
+    case OMP_CLAUSE_COPYPRIVATE:
+      decl = OMP_CLAUSE_DECL (c);
+      if (decl == error_mark_node || TREE_TYPE (decl) == error_mark_node)
+        {
+          remove = true;
+          break;
+        }
+    do_notice:
+      if (outer_ctx)
+        omp_notice_variable (outer_ctx, decl, true);
+      if (check_non_private
+          && region_type == ORT_WORKSHARE
+          && omp_check_private (ctx, decl))
+        {
+          error ("%s variable %qE is private in outer context",
+             check_non_private, DECL_NAME (decl));
+          remove = true;
+        }
+      break;
+
+    case OMP_CLAUSE_IF:
+      OMP_CLAUSE_OPERAND (c, 0)
+        = gimple_boolify (OMP_CLAUSE_OPERAND (c, 0));
+      /* Fall through.  */
+
+    case OMP_CLAUSE_SCHEDULE:
+    case OMP_CLAUSE_NUM_THREADS:
+      if (gimplify_expr (&OMP_CLAUSE_OPERAND (c, 0), pre_p, NULL,
+                 is_gimple_val, fb_rvalue) == GS_ERROR)
+          remove = true;
+      break;
+
+    case OMP_CLAUSE_NOWAIT:
+    case OMP_CLAUSE_ORDERED:
+    case OMP_CLAUSE_UNTIED:
+    case OMP_CLAUSE_COLLAPSE:
+      break;
+
+    case OMP_CLAUSE_DEFAULT:
+      ctx->default_kind = OMP_CLAUSE_DEFAULT_KIND (c);
+      break;
+
+    default:
+      gcc_unreachable ();
+    }
 
       if (remove)
-	*list_p = OMP_CLAUSE_CHAIN (c);
+    *list_p = OMP_CLAUSE_CHAIN (c);
       else
-	list_p = &OMP_CLAUSE_CHAIN (c);
+    list_p = &OMP_CLAUSE_CHAIN (c);
     }
 
   gimplify_omp_ctxp = ctx;
@@ -5655,26 +5753,26 @@
   else
     private_debug
       = lang_hooks.decls.omp_private_debug_clause (decl,
-						   !!(flags & GOVD_SHARED));
+                           !!(flags & GOVD_SHARED));
   if (private_debug)
     code = OMP_CLAUSE_PRIVATE;
   else if (flags & GOVD_SHARED)
     {
       if (is_global_var (decl))
-	{
-	  struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp->outer_context;
-	  while (ctx != NULL)
-	    {
-	      splay_tree_node on
-		= splay_tree_lookup (ctx->variables, (splay_tree_key) decl);
-	      if (on && (on->value & (GOVD_FIRSTPRIVATE | GOVD_LASTPRIVATE
-				      | GOVD_PRIVATE | GOVD_REDUCTION)) != 0)
-		break;
-	      ctx = ctx->outer_context;
-	    }
-	  if (ctx == NULL)
-	    return 0;
-	}
+    {
+      struct gimplify_omp_ctx *ctx = gimplify_omp_ctxp->outer_context;
+      while (ctx != NULL)
+        {
+          splay_tree_node on
+        = splay_tree_lookup (ctx->variables, (splay_tree_key) decl);
+          if (on && (on->value & (GOVD_FIRSTPRIVATE | GOVD_LASTPRIVATE
+                      | GOVD_PRIVATE | GOVD_REDUCTION)) != 0)
+        break;
+          ctx = ctx->outer_context;
+        }
+      if (ctx == NULL)
+        return 0;
+    }
       code = OMP_CLAUSE_SHARED;
     }
   else if (flags & GOVD_PRIVATE)
@@ -5684,7 +5782,7 @@
   else
     gcc_unreachable ();
 
-  clause = build_omp_clause (code);
+  clause = build_omp_clause (input_location, code);
   OMP_CLAUSE_DECL (clause) = decl;
   OMP_CLAUSE_CHAIN (clause) = *list_p;
   if (private_debug)
@@ -5709,63 +5807,63 @@
       bool remove = false;
 
       switch (OMP_CLAUSE_CODE (c))
-	{
-	case OMP_CLAUSE_PRIVATE:
-	case OMP_CLAUSE_SHARED:
-	case OMP_CLAUSE_FIRSTPRIVATE:
-	  decl = OMP_CLAUSE_DECL (c);
-	  n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl);
-	  remove = !(n->value & GOVD_SEEN);
-	  if (! remove)
-	    {
-	      bool shared = OMP_CLAUSE_CODE (c) == OMP_CLAUSE_SHARED;
-	      if ((n->value & GOVD_DEBUG_PRIVATE)
-		  || lang_hooks.decls.omp_private_debug_clause (decl, shared))
-		{
-		  gcc_assert ((n->value & GOVD_DEBUG_PRIVATE) == 0
-			      || ((n->value & GOVD_DATA_SHARE_CLASS)
-				  == GOVD_PRIVATE));
-		  OMP_CLAUSE_SET_CODE (c, OMP_CLAUSE_PRIVATE);
-		  OMP_CLAUSE_PRIVATE_DEBUG (c) = 1;
-		}
-	    }
-	  break;
-
-	case OMP_CLAUSE_LASTPRIVATE:
-	  /* Make sure OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE is set to
-	     accurately reflect the presence of a FIRSTPRIVATE clause.  */
-	  decl = OMP_CLAUSE_DECL (c);
-	  n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl);
-	  OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE (c)
-	    = (n->value & GOVD_FIRSTPRIVATE) != 0;
-	  break;
-	  
-	case OMP_CLAUSE_REDUCTION:
-	case OMP_CLAUSE_COPYIN:
-	case OMP_CLAUSE_COPYPRIVATE:
-	case OMP_CLAUSE_IF:
-	case OMP_CLAUSE_NUM_THREADS:
-	case OMP_CLAUSE_SCHEDULE:
-	case OMP_CLAUSE_NOWAIT:
-	case OMP_CLAUSE_ORDERED:
-	case OMP_CLAUSE_DEFAULT:
-	case OMP_CLAUSE_UNTIED:
-	case OMP_CLAUSE_COLLAPSE:
-	  break;
-
-	default:
-	  gcc_unreachable ();
-	}
+    {
+    case OMP_CLAUSE_PRIVATE:
+    case OMP_CLAUSE_SHARED:
+    case OMP_CLAUSE_FIRSTPRIVATE:
+      decl = OMP_CLAUSE_DECL (c);
+      n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl);
+      remove = !(n->value & GOVD_SEEN);
+      if (! remove)
+        {
+          bool shared = OMP_CLAUSE_CODE (c) == OMP_CLAUSE_SHARED;
+          if ((n->value & GOVD_DEBUG_PRIVATE)
+          || lang_hooks.decls.omp_private_debug_clause (decl, shared))
+        {
+          gcc_assert ((n->value & GOVD_DEBUG_PRIVATE) == 0
+                  || ((n->value & GOVD_DATA_SHARE_CLASS)
+                  == GOVD_PRIVATE));
+          OMP_CLAUSE_SET_CODE (c, OMP_CLAUSE_PRIVATE);
+          OMP_CLAUSE_PRIVATE_DEBUG (c) = 1;
+        }
+        }
+      break;
+
+    case OMP_CLAUSE_LASTPRIVATE:
+      /* Make sure OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE is set to
+         accurately reflect the presence of a FIRSTPRIVATE clause.  */
+      decl = OMP_CLAUSE_DECL (c);
+      n = splay_tree_lookup (ctx->variables, (splay_tree_key) decl);
+      OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE (c)
+        = (n->value & GOVD_FIRSTPRIVATE) != 0;
+      break;
+
+    case OMP_CLAUSE_REDUCTION:
+    case OMP_CLAUSE_COPYIN:
+    case OMP_CLAUSE_COPYPRIVATE:
+    case OMP_CLAUSE_IF:
+    case OMP_CLAUSE_NUM_THREADS:
+    case OMP_CLAUSE_SCHEDULE:
+    case OMP_CLAUSE_NOWAIT:
+    case OMP_CLAUSE_ORDERED:
+    case OMP_CLAUSE_DEFAULT:
+    case OMP_CLAUSE_UNTIED:
+    case OMP_CLAUSE_COLLAPSE:
+      break;
+
+    default:
+      gcc_unreachable ();
+    }
 
       if (remove)
-	*list_p = OMP_CLAUSE_CHAIN (c);
+    *list_p = OMP_CLAUSE_CHAIN (c);
       else
-	list_p = &OMP_CLAUSE_CHAIN (c);
+    list_p = &OMP_CLAUSE_CHAIN (c);
     }
 
   /* Add in any implicit data sharing.  */
   splay_tree_foreach (ctx->variables, gimplify_adjust_omp_clauses_1, list_p);
-  
+
   gimplify_omp_ctxp = ctx->outer_context;
   delete_omp_context (ctx);
 }
@@ -5784,9 +5882,9 @@
   struct gimplify_ctx gctx;
 
   gimplify_scan_omp_clauses (&OMP_PARALLEL_CLAUSES (expr), pre_p,
-			     OMP_PARALLEL_COMBINED (expr)
-			     ? ORT_COMBINED_PARALLEL
-			     : ORT_PARALLEL);
+                 OMP_PARALLEL_COMBINED (expr)
+                 ? ORT_COMBINED_PARALLEL
+                 : ORT_PARALLEL);
 
   push_gimplify_context (&gctx);
 
@@ -5799,8 +5897,8 @@
   gimplify_adjust_omp_clauses (&OMP_PARALLEL_CLAUSES (expr));
 
   g = gimple_build_omp_parallel (body,
-				 OMP_PARALLEL_CLAUSES (expr),
-				 NULL_TREE, NULL_TREE);
+                 OMP_PARALLEL_CLAUSES (expr),
+                 NULL_TREE, NULL_TREE);
   if (OMP_PARALLEL_COMBINED (expr))
     gimple_omp_set_subcode (g, GF_OMP_PARALLEL_COMBINED);
   gimplify_seq_add_stmt (pre_p, g);
@@ -5833,9 +5931,9 @@
   gimplify_adjust_omp_clauses (&OMP_TASK_CLAUSES (expr));
 
   g = gimple_build_omp_task (body,
-			     OMP_TASK_CLAUSES (expr),
-			     NULL_TREE, NULL_TREE,
-			     NULL_TREE, NULL_TREE, NULL_TREE);
+                 OMP_TASK_CLAUSES (expr),
+                 NULL_TREE, NULL_TREE,
+                 NULL_TREE, NULL_TREE, NULL_TREE);
   gimplify_seq_add_stmt (pre_p, g);
   *expr_p = NULL_TREE;
 }
@@ -5846,7 +5944,8 @@
 gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
 {
   tree for_stmt, decl, var, t;
-  enum gimplify_status ret = GS_OK;
+  enum gimplify_status ret = GS_ALL_DONE;
+  enum gimplify_status tret;
   gimple gfor;
   gimple_seq for_body, for_pre_body;
   int i;
@@ -5854,7 +5953,7 @@
   for_stmt = *expr_p;
 
   gimplify_scan_omp_clauses (&OMP_FOR_CLAUSES (for_stmt), pre_p,
-			     ORT_WORKSHARE);
+                 ORT_WORKSHARE);
 
   /* Handle OMP_FOR_INIT.  */
   for_pre_body = NULL;
@@ -5863,9 +5962,9 @@
 
   for_body = gimple_seq_alloc ();
   gcc_assert (TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt))
-	      == TREE_VEC_LENGTH (OMP_FOR_COND (for_stmt)));
+          == TREE_VEC_LENGTH (OMP_FOR_COND (for_stmt)));
   gcc_assert (TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt))
-	      == TREE_VEC_LENGTH (OMP_FOR_INCR (for_stmt)));
+          == TREE_VEC_LENGTH (OMP_FOR_INCR (for_stmt)));
   for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)); i++)
     {
       t = TREE_VEC_ELT (OMP_FOR_INIT (for_stmt), i);
@@ -5873,117 +5972,120 @@
       decl = TREE_OPERAND (t, 0);
       gcc_assert (DECL_P (decl));
       gcc_assert (INTEGRAL_TYPE_P (TREE_TYPE (decl))
-		  || POINTER_TYPE_P (TREE_TYPE (decl)));
+          || POINTER_TYPE_P (TREE_TYPE (decl)));
 
       /* Make sure the iteration variable is private.  */
       if (omp_is_private (gimplify_omp_ctxp, decl))
-	omp_notice_variable (gimplify_omp_ctxp, decl, true);
+    omp_notice_variable (gimplify_omp_ctxp, decl, true);
       else
-	omp_add_variable (gimplify_omp_ctxp, decl, GOVD_PRIVATE | GOVD_SEEN);
+    omp_add_variable (gimplify_omp_ctxp, decl, GOVD_PRIVATE | GOVD_SEEN);
 
       /* If DECL is not a gimple register, create a temporary variable to act
-	 as an iteration counter.  This is valid, since DECL cannot be
-	 modified in the body of the loop.  */
+     as an iteration counter.  This is valid, since DECL cannot be
+     modified in the body of the loop.  */
       if (!is_gimple_reg (decl))
-	{
-	  var = create_tmp_var (TREE_TYPE (decl), get_name (decl));
-	  TREE_OPERAND (t, 0) = var;
-                              
-	  gimplify_seq_add_stmt (&for_body, gimple_build_assign (decl, var));
-
-	  omp_add_variable (gimplify_omp_ctxp, var, GOVD_PRIVATE | GOVD_SEEN);
-	}
+    {
+      var = create_tmp_var (TREE_TYPE (decl), get_name (decl));
+      TREE_OPERAND (t, 0) = var;
+
+      gimplify_seq_add_stmt (&for_body, gimple_build_assign (decl, var));
+
+      omp_add_variable (gimplify_omp_ctxp, var, GOVD_PRIVATE | GOVD_SEEN);
+    }
       else
-	var = decl;
-
-      ret |= gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL,
-			    is_gimple_val, fb_rvalue);
+    var = decl;
+
+      tret = gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL,
+                is_gimple_val, fb_rvalue);
+      ret = MIN (ret, tret);
       if (ret == GS_ERROR)
-	return ret;
+    return ret;
 
       /* Handle OMP_FOR_COND.  */
       t = TREE_VEC_ELT (OMP_FOR_COND (for_stmt), i);
       gcc_assert (COMPARISON_CLASS_P (t));
       gcc_assert (TREE_OPERAND (t, 0) == decl);
 
-      ret |= gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL,
-			    is_gimple_val, fb_rvalue);
+      tret = gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL,
+                is_gimple_val, fb_rvalue);
+      ret = MIN (ret, tret);
 
       /* Handle OMP_FOR_INCR.  */
       t = TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i);
       switch (TREE_CODE (t))
-	{
-	case PREINCREMENT_EXPR:
-	case POSTINCREMENT_EXPR:
-	  t = build_int_cst (TREE_TYPE (decl), 1);
-	  t = build2 (PLUS_EXPR, TREE_TYPE (decl), var, t);
-	  t = build2 (MODIFY_EXPR, TREE_TYPE (var), var, t);
-	  TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i) = t;
-	  break;
-
-	case PREDECREMENT_EXPR:
-	case POSTDECREMENT_EXPR:
-	  t = build_int_cst (TREE_TYPE (decl), -1);
-	  t = build2 (PLUS_EXPR, TREE_TYPE (decl), var, t);
-	  t = build2 (MODIFY_EXPR, TREE_TYPE (var), var, t);
-	  TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i) = t;
-	  break;
-
-	case MODIFY_EXPR:
-	  gcc_assert (TREE_OPERAND (t, 0) == decl);
-	  TREE_OPERAND (t, 0) = var;
-
-	  t = TREE_OPERAND (t, 1);
-	  switch (TREE_CODE (t))
-	    {
-	    case PLUS_EXPR:
-	      if (TREE_OPERAND (t, 1) == decl)
-		{
-		  TREE_OPERAND (t, 1) = TREE_OPERAND (t, 0);
-		  TREE_OPERAND (t, 0) = var;
-		  break;
-		}
-
-	      /* Fallthru.  */
-	    case MINUS_EXPR:
-	    case POINTER_PLUS_EXPR:
-	      gcc_assert (TREE_OPERAND (t, 0) == decl);
-	      TREE_OPERAND (t, 0) = var;
-	      break;
-	    default:
-	      gcc_unreachable ();
-	    }
-
-	  ret |= gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL,
-				is_gimple_val, fb_rvalue);
-	  break;
-
-	default:
-	  gcc_unreachable ();
-	}
+    {
+    case PREINCREMENT_EXPR:
+    case POSTINCREMENT_EXPR:
+      t = build_int_cst (TREE_TYPE (decl), 1);
+      t = build2 (PLUS_EXPR, TREE_TYPE (decl), var, t);
+      t = build2 (MODIFY_EXPR, TREE_TYPE (var), var, t);
+      TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i) = t;
+      break;
+
+    case PREDECREMENT_EXPR:
+    case POSTDECREMENT_EXPR:
+      t = build_int_cst (TREE_TYPE (decl), -1);
+      t = build2 (PLUS_EXPR, TREE_TYPE (decl), var, t);
+      t = build2 (MODIFY_EXPR, TREE_TYPE (var), var, t);
+      TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i) = t;
+      break;
+
+    case MODIFY_EXPR:
+      gcc_assert (TREE_OPERAND (t, 0) == decl);
+      TREE_OPERAND (t, 0) = var;
+
+      t = TREE_OPERAND (t, 1);
+      switch (TREE_CODE (t))
+        {
+        case PLUS_EXPR:
+          if (TREE_OPERAND (t, 1) == decl)
+        {
+          TREE_OPERAND (t, 1) = TREE_OPERAND (t, 0);
+          TREE_OPERAND (t, 0) = var;
+          break;
+        }
+
+          /* Fallthru.  */
+        case MINUS_EXPR:
+        case POINTER_PLUS_EXPR:
+          gcc_assert (TREE_OPERAND (t, 0) == decl);
+          TREE_OPERAND (t, 0) = var;
+          break;
+        default:
+          gcc_unreachable ();
+        }
+
+      tret = gimplify_expr (&TREE_OPERAND (t, 1), &for_pre_body, NULL,
+                is_gimple_val, fb_rvalue);
+      ret = MIN (ret, tret);
+      break;
+
+    default:
+      gcc_unreachable ();
+    }
 
       if (var != decl || TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)) > 1)
-	{
-	  tree c;
-	  for (c = OMP_FOR_CLAUSES (for_stmt); c ; c = OMP_CLAUSE_CHAIN (c))
-	    if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE
-		&& OMP_CLAUSE_DECL (c) == decl
-		&& OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c) == NULL)
-	      {
-		t = TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i);
-		gcc_assert (TREE_CODE (t) == MODIFY_EXPR);
-		gcc_assert (TREE_OPERAND (t, 0) == var);
-		t = TREE_OPERAND (t, 1);
-		gcc_assert (TREE_CODE (t) == PLUS_EXPR
-			    || TREE_CODE (t) == MINUS_EXPR
-			    || TREE_CODE (t) == POINTER_PLUS_EXPR);
-		gcc_assert (TREE_OPERAND (t, 0) == var);
-		t = build2 (TREE_CODE (t), TREE_TYPE (decl), decl,
-			    TREE_OPERAND (t, 1));
-		gimplify_assign (decl, t,
-				 &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c));
-	    }
-	}
+    {
+      tree c;
+      for (c = OMP_FOR_CLAUSES (for_stmt); c ; c = OMP_CLAUSE_CHAIN (c))
+        if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE
+        && OMP_CLAUSE_DECL (c) == decl
+        && OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c) == NULL)
+          {
+        t = TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i);
+        gcc_assert (TREE_CODE (t) == MODIFY_EXPR);
+        gcc_assert (TREE_OPERAND (t, 0) == var);
+        t = TREE_OPERAND (t, 1);
+        gcc_assert (TREE_CODE (t) == PLUS_EXPR
+                || TREE_CODE (t) == MINUS_EXPR
+                || TREE_CODE (t) == POINTER_PLUS_EXPR);
+        gcc_assert (TREE_OPERAND (t, 0) == var);
+        t = build2 (TREE_CODE (t), TREE_TYPE (decl), decl,
+                TREE_OPERAND (t, 1));
+        gimplify_assign (decl, t,
+                 &OMP_CLAUSE_LASTPRIVATE_GIMPLE_SEQ (c));
+        }
+    }
     }
 
   gimplify_and_add (OMP_FOR_BODY (for_stmt), &for_body);
@@ -5991,8 +6093,8 @@
   gimplify_adjust_omp_clauses (&OMP_FOR_CLAUSES (for_stmt));
 
   gfor = gimple_build_omp_for (for_body, OMP_FOR_CLAUSES (for_stmt),
-			       TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)),
-			       for_pre_body);
+                   TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)),
+                   for_pre_body);
 
   for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)); i++)
     {
@@ -6035,40 +6137,34 @@
 }
 
 /* A subroutine of gimplify_omp_atomic.  The front end is supposed to have
-   stabilized the lhs of the atomic operation as *ADDR.  Return true if 
+   stabilized the lhs of the atomic operation as *ADDR.  Return true if
    EXPR is this stabilized form.  */
 
 static bool
 goa_lhs_expr_p (tree expr, tree addr)
 {
   /* Also include casts to other type variants.  The C front end is fond
-     of adding these for e.g. volatile variables.  This is like 
+     of adding these for e.g. volatile variables.  This is like
      STRIP_TYPE_NOPS but includes the main variant lookup.  */
-  while ((CONVERT_EXPR_P (expr)
-          || TREE_CODE (expr) == NON_LVALUE_EXPR)
-         && TREE_OPERAND (expr, 0) != error_mark_node
-         && (TYPE_MAIN_VARIANT (TREE_TYPE (expr))
-             == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (expr, 0)))))
-    expr = TREE_OPERAND (expr, 0);
+  STRIP_USELESS_TYPE_CONVERSION (expr);
 
   if (TREE_CODE (expr) == INDIRECT_REF)
     {
       expr = TREE_OPERAND (expr, 0);
       while (expr != addr
-	     && (CONVERT_EXPR_P (expr)
-		 || TREE_CODE (expr) == NON_LVALUE_EXPR)
-	     && TREE_CODE (expr) == TREE_CODE (addr)
-	     && TYPE_MAIN_VARIANT (TREE_TYPE (expr))
-		== TYPE_MAIN_VARIANT (TREE_TYPE (addr)))
-	{
-	  expr = TREE_OPERAND (expr, 0);
-	  addr = TREE_OPERAND (addr, 0);
-	}
+         && (CONVERT_EXPR_P (expr)
+         || TREE_CODE (expr) == NON_LVALUE_EXPR)
+         && TREE_CODE (expr) == TREE_CODE (addr)
+         && types_compatible_p (TREE_TYPE (expr), TREE_TYPE (addr)))
+    {
+      expr = TREE_OPERAND (expr, 0);
+      addr = TREE_OPERAND (addr, 0);
+    }
       if (expr == addr)
-	return true;
+    return true;
       return (TREE_CODE (addr) == ADDR_EXPR
-	      && TREE_CODE (expr) == ADDR_EXPR
-	      && TREE_OPERAND (addr, 0) == TREE_OPERAND (expr, 0));
+          && TREE_CODE (expr) == ADDR_EXPR
+          && TREE_OPERAND (addr, 0) == TREE_OPERAND (expr, 0));
     }
   if (TREE_CODE (addr) == ADDR_EXPR && expr == TREE_OPERAND (addr, 0))
     return true;
@@ -6082,7 +6178,7 @@
 
 static int
 goa_stabilize_expr (tree *expr_p, gimple_seq *pre_p, tree lhs_addr,
-		    tree lhs_var)
+            tree lhs_var)
 {
   tree expr = *expr_p;
   int saw_lhs;
@@ -6094,31 +6190,31 @@
     }
   if (is_gimple_val (expr))
     return 0;
- 
+
   saw_lhs = 0;
   switch (TREE_CODE_CLASS (TREE_CODE (expr)))
     {
     case tcc_binary:
     case tcc_comparison:
       saw_lhs |= goa_stabilize_expr (&TREE_OPERAND (expr, 1), pre_p, lhs_addr,
-				     lhs_var);
+                     lhs_var);
     case tcc_unary:
       saw_lhs |= goa_stabilize_expr (&TREE_OPERAND (expr, 0), pre_p, lhs_addr,
-				     lhs_var);
+                     lhs_var);
       break;
     case tcc_expression:
       switch (TREE_CODE (expr))
-	{
-	case TRUTH_ANDIF_EXPR:
-	case TRUTH_ORIF_EXPR:
-	  saw_lhs |= goa_stabilize_expr (&TREE_OPERAND (expr, 1), pre_p,
-					 lhs_addr, lhs_var);
-	  saw_lhs |= goa_stabilize_expr (&TREE_OPERAND (expr, 0), pre_p,
-					 lhs_addr, lhs_var);
-	  break;
-	default:
-	  break;
-	}
+    {
+    case TRUTH_ANDIF_EXPR:
+    case TRUTH_ORIF_EXPR:
+      saw_lhs |= goa_stabilize_expr (&TREE_OPERAND (expr, 1), pre_p,
+                     lhs_addr, lhs_var);
+      saw_lhs |= goa_stabilize_expr (&TREE_OPERAND (expr, 0), pre_p,
+                     lhs_addr, lhs_var);
+      break;
+    default:
+      break;
+    }
       break;
     default:
       break;
@@ -6129,7 +6225,7 @@
       enum gimplify_status gs;
       gs = gimplify_expr (expr_p, pre_p, NULL, is_gimple_val, fb_rvalue);
       if (gs != GS_ALL_DONE)
-	saw_lhs = -1;
+    saw_lhs = -1;
     }
 
   return saw_lhs;
@@ -6207,19 +6303,19 @@
        the inner expression, so if a separate POST sequence was not
        used, the resulting sequence would be:
 
-       	    1	t.1 = *p
-       	    2	p = p - 1
-       	    3	t.2 = t.1 + 1
-       	    4	*p = t.2
+            1   t.1 = *p
+            2   p = p - 1
+            3   t.2 = t.1 + 1
+            4   *p = t.2
 
        However, the post-decrement operation in line #2 must not be
        evaluated until after the store to *p at line #4, so the
        correct sequence should be:
 
-       	    1	t.1 = *p
-       	    2	t.2 = t.1 + 1
-       	    3	*p = t.2
-       	    4	p = p - 1
+            1   t.1 = *p
+            2   t.2 = t.1 + 1
+            3   *p = t.2
+            4   p = p - 1
 
        So, by specifying a separate post queue, it is possible
        to emit the post side-effects in the correct order.
@@ -6248,7 +6344,7 @@
 
 enum gimplify_status
 gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
-	       bool (*gimple_test_f) (tree), fallback_t fallback)
+           bool (*gimple_test_f) (tree), fallback_t fallback)
 {
   tree tmp;
   gimple_seq internal_pre = NULL;
@@ -6272,20 +6368,16 @@
   if (gimple_test_f == is_gimple_reg)
     gcc_assert (fallback & (fb_rvalue | fb_lvalue));
   else if (gimple_test_f == is_gimple_val
-           || gimple_test_f == is_gimple_formal_tmp_rhs
-           || gimple_test_f == is_gimple_formal_tmp_or_call_rhs
-           || gimple_test_f == is_gimple_formal_tmp_reg
-           || gimple_test_f == is_gimple_formal_tmp_var
            || gimple_test_f == is_gimple_call_addr
            || gimple_test_f == is_gimple_condexpr
            || gimple_test_f == is_gimple_mem_rhs
-           || gimple_test_f == is_gimple_mem_or_call_rhs
+           || gimple_test_f == is_gimple_mem_rhs_or_call
            || gimple_test_f == is_gimple_reg_rhs
-           || gimple_test_f == is_gimple_reg_or_call_rhs
+           || gimple_test_f == is_gimple_reg_rhs_or_call
            || gimple_test_f == is_gimple_asm_val)
     gcc_assert (fallback & fb_rvalue);
   else if (gimple_test_f == is_gimple_min_lval
-	   || gimple_test_f == is_gimple_lvalue)
+       || gimple_test_f == is_gimple_lvalue)
     gcc_assert (fallback & fb_lvalue);
   else if (gimple_test_f == is_gimple_addressable)
     gcc_assert (fallback & fb_either);
@@ -6294,8 +6386,8 @@
   else
     {
       /* We should have recognized the GIMPLE_TEST_F predicate to
-	 know what kind of fallback to use in case a temporary is
-	 needed to hold the value or address of *EXPR_P.  */
+     know what kind of fallback to use in case a temporary is
+     needed to hold the value or address of *EXPR_P.  */
       gcc_unreachable ();
     }
 
@@ -6330,7 +6422,7 @@
   do
     {
       /* Strip away as many useless type conversions as possible
-	 at the toplevel.  */
+     at the toplevel.  */
       STRIP_USELESS_TYPE_CONVERSION (*expr_p);
 
       /* Remember the expr.  */
@@ -6338,583 +6430,590 @@
 
       /* Die, die, die, my darling.  */
       if (save_expr == error_mark_node
-	  || (TREE_TYPE (save_expr)
-	      && TREE_TYPE (save_expr) == error_mark_node))
-	{
-	  ret = GS_ERROR;
-	  break;
-	}
+      || (TREE_TYPE (save_expr)
+          && TREE_TYPE (save_expr) == error_mark_node))
+    {
+      ret = GS_ERROR;
+      break;
+    }
 
       /* Do any language-specific gimplification.  */
-      ret = lang_hooks.gimplify_expr (expr_p, pre_p, post_p);
+      ret = ((enum gimplify_status)
+         lang_hooks.gimplify_expr (expr_p, pre_p, post_p));
       if (ret == GS_OK)
-	{
-	  if (*expr_p == NULL_TREE)
-	    break;
-	  if (*expr_p != save_expr)
-	    continue;
-	}
+    {
+      if (*expr_p == NULL_TREE)
+        break;
+      if (*expr_p != save_expr)
+        continue;
+    }
       else if (ret != GS_UNHANDLED)
-	break;
+    break;
 
       ret = GS_OK;
       switch (TREE_CODE (*expr_p))
-	{
-	  /* First deal with the special cases.  */
-
-	case POSTINCREMENT_EXPR:
-	case POSTDECREMENT_EXPR:
-	case PREINCREMENT_EXPR:
-	case PREDECREMENT_EXPR:
-	  ret = gimplify_self_mod_expr (expr_p, pre_p, post_p,
-					fallback != fb_none);
-	  break;
-
-	case ARRAY_REF:
-	case ARRAY_RANGE_REF:
-	case REALPART_EXPR:
-	case IMAGPART_EXPR:
-	case COMPONENT_REF:
-	case VIEW_CONVERT_EXPR:
-	  ret = gimplify_compound_lval (expr_p, pre_p, post_p,
-					fallback ? fallback : fb_rvalue);
-	  break;
-
-	case COND_EXPR:
-	  ret = gimplify_cond_expr (expr_p, pre_p, fallback);
-
-	  /* C99 code may assign to an array in a structure value of a
-	     conditional expression, and this has undefined behavior
-	     only on execution, so create a temporary if an lvalue is
-	     required.  */
-	  if (fallback == fb_lvalue)
-	    {
-	      *expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p);
-	      mark_addressable (*expr_p);
-	    }
-	  break;
-
-	case CALL_EXPR:
-	  ret = gimplify_call_expr (expr_p, pre_p, fallback != fb_none);
-
-	  /* C99 code may assign to an array in a structure returned
-	     from a function, and this has undefined behavior only on
-	     execution, so create a temporary if an lvalue is
-	     required.  */
-	  if (fallback == fb_lvalue)
-	    {
-	      *expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p);
-	      mark_addressable (*expr_p);
-	    }
-	  break;
-
-	case TREE_LIST:
-	  gcc_unreachable ();
-
-	case COMPOUND_EXPR:
-	  ret = gimplify_compound_expr (expr_p, pre_p, fallback != fb_none);
-	  break;
-
-	case MODIFY_EXPR:
-	case INIT_EXPR:
-	  ret = gimplify_modify_expr (expr_p, pre_p, post_p,
-				      fallback != fb_none);
-	  break;
-
-	case TRUTH_ANDIF_EXPR:
-	case TRUTH_ORIF_EXPR:
-	  ret = gimplify_boolean_expr (expr_p);
-	  break;
-
-	case TRUTH_NOT_EXPR:
-	  if (TREE_CODE (TREE_TYPE (*expr_p)) != BOOLEAN_TYPE)
-	    {
-	      tree type = TREE_TYPE (*expr_p);
-	      *expr_p = fold_convert (type, gimple_boolify (*expr_p));
-	      ret = GS_OK;
-	      break;
-	    }
-
-	  ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
-			       is_gimple_val, fb_rvalue);
-	  recalculate_side_effects (*expr_p);
-	  break;
-
-	case ADDR_EXPR:
-	  ret = gimplify_addr_expr (expr_p, pre_p, post_p);
-	  break;
-
-	case VA_ARG_EXPR:
-	  ret = gimplify_va_arg_expr (expr_p, pre_p, post_p);
-	  break;
-
-	CASE_CONVERT:
-	  if (IS_EMPTY_STMT (*expr_p))
-	    {
-	      ret = GS_ALL_DONE;
-	      break;
-	    }
-
-	  if (VOID_TYPE_P (TREE_TYPE (*expr_p))
-	      || fallback == fb_none)
-	    {
-	      /* Just strip a conversion to void (or in void context) and
-		 try again.  */
-	      *expr_p = TREE_OPERAND (*expr_p, 0);
-	      break;
-	    }
-
-	  ret = gimplify_conversion (expr_p);
-	  if (ret == GS_ERROR)
-	    break;
-	  if (*expr_p != save_expr)
-	    break;
-	  /* FALLTHRU */
-
-	case FIX_TRUNC_EXPR:
-	  /* unary_expr: ... | '(' cast ')' val | ...  */
-	  ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
-			       is_gimple_val, fb_rvalue);
-	  recalculate_side_effects (*expr_p);
-	  break;
-
-	case INDIRECT_REF:
-	  *expr_p = fold_indirect_ref (*expr_p);
-	  if (*expr_p != save_expr)
-	    break;
-	  /* else fall through.  */
-	case ALIGN_INDIRECT_REF:
-	case MISALIGNED_INDIRECT_REF:
-	  ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
-			       is_gimple_reg, fb_rvalue);
-	  recalculate_side_effects (*expr_p);
-	  break;
-
-	  /* Constants need not be gimplified.  */
-	case INTEGER_CST:
-	case REAL_CST:
-	case FIXED_CST:
-	case STRING_CST:
-	case COMPLEX_CST:
-	case VECTOR_CST:
-	  ret = GS_ALL_DONE;
-	  break;
-
-	case CONST_DECL:
-	  /* If we require an lvalue, such as for ADDR_EXPR, retain the
-	     CONST_DECL node.  Otherwise the decl is replaceable by its
-	     value.  */
-	  /* ??? Should be == fb_lvalue, but ADDR_EXPR passes fb_either.  */
-	  if (fallback & fb_lvalue)
-	    ret = GS_ALL_DONE;
-	  else
-	    *expr_p = DECL_INITIAL (*expr_p);
-	  break;
-
-	case DECL_EXPR:
-	  ret = gimplify_decl_expr (expr_p, pre_p);
-	  break;
-
-	case EXC_PTR_EXPR:
-	  /* FIXME make this a decl.  */
-	  ret = GS_ALL_DONE;
-	  break;
-
-	case BIND_EXPR:
-	  ret = gimplify_bind_expr (expr_p, pre_p);
-	  break;
-
-	case LOOP_EXPR:
-	  ret = gimplify_loop_expr (expr_p, pre_p);
-	  break;
-
-	case SWITCH_EXPR:
-	  ret = gimplify_switch_expr (expr_p, pre_p);
-	  break;
-
-	case EXIT_EXPR:
-	  ret = gimplify_exit_expr (expr_p);
-	  break;
-
-	case GOTO_EXPR:
-	  /* If the target is not LABEL, then it is a computed jump
-	     and the target needs to be gimplified.  */
-	  if (TREE_CODE (GOTO_DESTINATION (*expr_p)) != LABEL_DECL)
-	    {
-	      ret = gimplify_expr (&GOTO_DESTINATION (*expr_p), pre_p,
-				   NULL, is_gimple_val, fb_rvalue);
-	      if (ret == GS_ERROR)
-		break;
-	    }
-	  gimplify_seq_add_stmt (pre_p,
-			  gimple_build_goto (GOTO_DESTINATION (*expr_p)));
-	  break;
-
-	case PREDICT_EXPR:
-	  gimplify_seq_add_stmt (pre_p,
-			gimple_build_predict (PREDICT_EXPR_PREDICTOR (*expr_p),
-					      PREDICT_EXPR_OUTCOME (*expr_p)));
-	  ret = GS_ALL_DONE;
-	  break;
-
-	case LABEL_EXPR:
-	  ret = GS_ALL_DONE;
-	  gcc_assert (decl_function_context (LABEL_EXPR_LABEL (*expr_p))
-		      == current_function_decl);
-	  gimplify_seq_add_stmt (pre_p,
-			  gimple_build_label (LABEL_EXPR_LABEL (*expr_p)));
-	  break;
-
-	case CASE_LABEL_EXPR:
-	  ret = gimplify_case_label_expr (expr_p, pre_p);
-	  break;
-
-	case RETURN_EXPR:
-	  ret = gimplify_return_expr (*expr_p, pre_p);
-	  break;
-
-	case CONSTRUCTOR:
-	  /* Don't reduce this in place; let gimplify_init_constructor work its
-	     magic.  Buf if we're just elaborating this for side effects, just
-	     gimplify any element that has side-effects.  */
-	  if (fallback == fb_none)
-	    {
-	      unsigned HOST_WIDE_INT ix;
-	      constructor_elt *ce;
-	      tree temp = NULL_TREE;
-	      for (ix = 0;
-		   VEC_iterate (constructor_elt, CONSTRUCTOR_ELTS (*expr_p),
-				ix, ce);
-		   ix++)
-		if (TREE_SIDE_EFFECTS (ce->value))
-		  append_to_statement_list (ce->value, &temp);
-
-	      *expr_p = temp;
-	      ret = GS_OK;
-	    }
-	  /* C99 code may assign to an array in a constructed
-	     structure or union, and this has undefined behavior only
-	     on execution, so create a temporary if an lvalue is
-	     required.  */
-	  else if (fallback == fb_lvalue)
-	    {
-	      *expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p);
-	      mark_addressable (*expr_p);
-	    }
-	  else
-	    ret = GS_ALL_DONE;
-	  break;
-
-	  /* The following are special cases that are not handled by the
-	     original GIMPLE grammar.  */
-
-	  /* SAVE_EXPR nodes are converted into a GIMPLE identifier and
-	     eliminated.  */
-	case SAVE_EXPR:
-	  ret = gimplify_save_expr (expr_p, pre_p, post_p);
-	  break;
-
-	case BIT_FIELD_REF:
-	  {
-	    enum gimplify_status r0, r1, r2;
-
-	    r0 = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,
-				post_p, is_gimple_lvalue, fb_either);
-	    r1 = gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p,
-				post_p, is_gimple_val, fb_rvalue);
-	    r2 = gimplify_expr (&TREE_OPERAND (*expr_p, 2), pre_p,
-				post_p, is_gimple_val, fb_rvalue);
-	    recalculate_side_effects (*expr_p);
-
-	    ret = MIN (r0, MIN (r1, r2));
-	  }
-	  break;
-
-	case NON_LVALUE_EXPR:
-	  /* This should have been stripped above.  */
-	  gcc_unreachable ();
-
-	case ASM_EXPR:
-	  ret = gimplify_asm_expr (expr_p, pre_p, post_p);
-	  break;
-
-	case TRY_FINALLY_EXPR:
-	case TRY_CATCH_EXPR:
-	  {
-	    gimple_seq eval, cleanup;
-	    gimple try_;
-
-	    eval = cleanup = NULL;
-	    gimplify_and_add (TREE_OPERAND (*expr_p, 0), &eval);
-	    gimplify_and_add (TREE_OPERAND (*expr_p, 1), &cleanup);
-	    /* Don't create bogus GIMPLE_TRY with empty cleanup.  */
-	    if (gimple_seq_empty_p (cleanup))
-	      {
-		gimple_seq_add_seq (pre_p, eval);
-		ret = GS_ALL_DONE;
-		break;
-	      }
-	    try_ = gimple_build_try (eval, cleanup,
-				     TREE_CODE (*expr_p) == TRY_FINALLY_EXPR
-				     ? GIMPLE_TRY_FINALLY
-				     : GIMPLE_TRY_CATCH);
-	    if (TREE_CODE (*expr_p) == TRY_CATCH_EXPR)
-	      gimple_try_set_catch_is_cleanup (try_,
-					       TRY_CATCH_IS_CLEANUP (*expr_p));
-	    gimplify_seq_add_stmt (pre_p, try_);
-	    ret = GS_ALL_DONE;
-	    break;
-	  }
-
-	case CLEANUP_POINT_EXPR:
-	  ret = gimplify_cleanup_point_expr (expr_p, pre_p);
-	  break;
-
-	case TARGET_EXPR:
-	  ret = gimplify_target_expr (expr_p, pre_p, post_p);
-	  break;
-
-	case CATCH_EXPR:
-	  {
-	    gimple c;
-	    gimple_seq handler = NULL;
-	    gimplify_and_add (CATCH_BODY (*expr_p), &handler);
-	    c = gimple_build_catch (CATCH_TYPES (*expr_p), handler);
-	    gimplify_seq_add_stmt (pre_p, c);
-	    ret = GS_ALL_DONE;
-	    break;
-	  }
-
-	case EH_FILTER_EXPR:
-	  {
-	    gimple ehf;
-	    gimple_seq failure = NULL;
-
-	    gimplify_and_add (EH_FILTER_FAILURE (*expr_p), &failure);
-	    ehf = gimple_build_eh_filter (EH_FILTER_TYPES (*expr_p), failure);
-	    gimple_eh_filter_set_must_not_throw
-	      (ehf, EH_FILTER_MUST_NOT_THROW (*expr_p));
-	    gimplify_seq_add_stmt (pre_p, ehf);
-	    ret = GS_ALL_DONE;
-	    break;
-	  }
-
-	case CHANGE_DYNAMIC_TYPE_EXPR:
-	  {
-	    gimple cdt;
-
-	    ret = gimplify_expr (&CHANGE_DYNAMIC_TYPE_LOCATION (*expr_p),
-				 pre_p, post_p, is_gimple_reg, fb_lvalue);
-	    cdt = gimple_build_cdt (CHANGE_DYNAMIC_TYPE_NEW_TYPE (*expr_p),
-				    CHANGE_DYNAMIC_TYPE_LOCATION (*expr_p));
-	    gimplify_seq_add_stmt (pre_p, cdt);
-	    ret = GS_ALL_DONE;
-	  }
-	  break;
-
-	case OBJ_TYPE_REF:
-	  {
-	    enum gimplify_status r0, r1;
-	    r0 = gimplify_expr (&OBJ_TYPE_REF_OBJECT (*expr_p), pre_p,
-				post_p, is_gimple_val, fb_rvalue);
-	    r1 = gimplify_expr (&OBJ_TYPE_REF_EXPR (*expr_p), pre_p,
-				post_p, is_gimple_val, fb_rvalue);
-	    TREE_SIDE_EFFECTS (*expr_p) = 0;
-	    ret = MIN (r0, r1);
-	  }
-	  break;
-
-	case LABEL_DECL:
-	  /* We get here when taking the address of a label.  We mark
-	     the label as "forced"; meaning it can never be removed and
-	     it is a potential target for any computed goto.  */
-	  FORCED_LABEL (*expr_p) = 1;
-	  ret = GS_ALL_DONE;
-	  break;
-
-	case STATEMENT_LIST:
-	  ret = gimplify_statement_list (expr_p, pre_p);
-	  break;
-
-	case WITH_SIZE_EXPR:
-	  {
-	    gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,
-			   post_p == &internal_post ? NULL : post_p,
-			   gimple_test_f, fallback);
-	    gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p, post_p,
-			   is_gimple_val, fb_rvalue);
-	  }
-	  break;
-
-	case VAR_DECL:
-	case PARM_DECL:
-	  ret = gimplify_var_or_parm_decl (expr_p);
-	  break;
-
-	case RESULT_DECL:
-	  /* When within an OpenMP context, notice uses of variables.  */
-	  if (gimplify_omp_ctxp)
-	    omp_notice_variable (gimplify_omp_ctxp, *expr_p, true);
-	  ret = GS_ALL_DONE;
-	  break;
-
-	case SSA_NAME:
-	  /* Allow callbacks into the gimplifier during optimization.  */
-	  ret = GS_ALL_DONE;
-	  break;
-
-	case OMP_PARALLEL:
-	  gimplify_omp_parallel (expr_p, pre_p);
-	  ret = GS_ALL_DONE;
-	  break;
-
-	case OMP_TASK:
-	  gimplify_omp_task (expr_p, pre_p);
-	  ret = GS_ALL_DONE;
-	  break;
-
-	case OMP_FOR:
-	  ret = gimplify_omp_for (expr_p, pre_p);
-	  break;
-
-	case OMP_SECTIONS:
-	case OMP_SINGLE:
-	  gimplify_omp_workshare (expr_p, pre_p);
-	  ret = GS_ALL_DONE;
-	  break;
-
-	case OMP_SECTION:
-	case OMP_MASTER:
-	case OMP_ORDERED:
-	case OMP_CRITICAL:
-	  {
-	    gimple_seq body = NULL;
-	    gimple g;
-
-	    gimplify_and_add (OMP_BODY (*expr_p), &body);
-	    switch (TREE_CODE (*expr_p))
-	      {
-	      case OMP_SECTION:
-	        g = gimple_build_omp_section (body);
-	        break;
-	      case OMP_MASTER:
-	        g = gimple_build_omp_master (body);
-		break;
-	      case OMP_ORDERED:
-		g = gimple_build_omp_ordered (body);
-		break;
-	      case OMP_CRITICAL:
-		g = gimple_build_omp_critical (body,
-		    			       OMP_CRITICAL_NAME (*expr_p));
-		break;
-	      default:
-		gcc_unreachable ();
-	      }
-	    gimplify_seq_add_stmt (pre_p, g);
-	    ret = GS_ALL_DONE;
-	    break;
-	  }
-
-	case OMP_ATOMIC:
-	  ret = gimplify_omp_atomic (expr_p, pre_p);
-	  break;
-
-	case POINTER_PLUS_EXPR:
+    {
+      /* First deal with the special cases.  */
+
+    case POSTINCREMENT_EXPR:
+    case POSTDECREMENT_EXPR:
+    case PREINCREMENT_EXPR:
+    case PREDECREMENT_EXPR:
+      ret = gimplify_self_mod_expr (expr_p, pre_p, post_p,
+                    fallback != fb_none);
+      break;
+
+    case ARRAY_REF:
+    case ARRAY_RANGE_REF:
+    case REALPART_EXPR:
+    case IMAGPART_EXPR:
+    case COMPONENT_REF:
+    case VIEW_CONVERT_EXPR:
+      ret = gimplify_compound_lval (expr_p, pre_p, post_p,
+                    fallback ? fallback : fb_rvalue);
+      break;
+
+    case COND_EXPR:
+      ret = gimplify_cond_expr (expr_p, pre_p, fallback);
+
+      /* C99 code may assign to an array in a structure value of a
+         conditional expression, and this has undefined behavior
+         only on execution, so create a temporary if an lvalue is
+         required.  */
+      if (fallback == fb_lvalue)
+        {
+          *expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p);
+          mark_addressable (*expr_p);
+        }
+      break;
+
+    case CALL_EXPR:
+      ret = gimplify_call_expr (expr_p, pre_p, fallback != fb_none);
+
+      /* C99 code may assign to an array in a structure returned
+         from a function, and this has undefined behavior only on
+         execution, so create a temporary if an lvalue is
+         required.  */
+      if (fallback == fb_lvalue)
+        {
+          *expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p);
+          mark_addressable (*expr_p);
+        }
+      break;
+
+    case TREE_LIST:
+      gcc_unreachable ();
+
+    case COMPOUND_EXPR:
+      ret = gimplify_compound_expr (expr_p, pre_p, fallback != fb_none);
+      break;
+
+    case COMPOUND_LITERAL_EXPR:
+      ret = gimplify_compound_literal_expr (expr_p, pre_p);
+      break;
+
+    case MODIFY_EXPR:
+    case INIT_EXPR:
+      ret = gimplify_modify_expr (expr_p, pre_p, post_p,
+                      fallback != fb_none);
+      break;
+
+    case TRUTH_ANDIF_EXPR:
+    case TRUTH_ORIF_EXPR:
+      /* Pass the source location of the outer expression.  */
+      ret = gimplify_boolean_expr (expr_p, saved_location);
+      break;
+
+    case TRUTH_NOT_EXPR:
+      if (TREE_CODE (TREE_TYPE (*expr_p)) != BOOLEAN_TYPE)
+        {
+          tree type = TREE_TYPE (*expr_p);
+          *expr_p = fold_convert (type, gimple_boolify (*expr_p));
+          ret = GS_OK;
+          break;
+        }
+
+      ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
+                   is_gimple_val, fb_rvalue);
+      recalculate_side_effects (*expr_p);
+      break;
+
+    case ADDR_EXPR:
+      ret = gimplify_addr_expr (expr_p, pre_p, post_p);
+      break;
+
+    case VA_ARG_EXPR:
+      ret = gimplify_va_arg_expr (expr_p, pre_p, post_p);
+      break;
+
+    CASE_CONVERT:
+      if (IS_EMPTY_STMT (*expr_p))
+        {
+          ret = GS_ALL_DONE;
+          break;
+        }
+
+      if (VOID_TYPE_P (TREE_TYPE (*expr_p))
+          || fallback == fb_none)
+        {
+          /* Just strip a conversion to void (or in void context) and
+         try again.  */
+          *expr_p = TREE_OPERAND (*expr_p, 0);
+          break;
+        }
+
+      ret = gimplify_conversion (expr_p);
+      if (ret == GS_ERROR)
+        break;
+      if (*expr_p != save_expr)
+        break;
+      /* FALLTHRU */
+
+    case FIX_TRUNC_EXPR:
+      /* unary_expr: ... | '(' cast ')' val | ...  */
+      ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
+                   is_gimple_val, fb_rvalue);
+      recalculate_side_effects (*expr_p);
+      break;
+
+    case INDIRECT_REF:
+      *expr_p = fold_indirect_ref_loc (input_location, *expr_p);
+      if (*expr_p != save_expr)
+        break;
+      /* else fall through.  */
+    case ALIGN_INDIRECT_REF:
+    case MISALIGNED_INDIRECT_REF:
+      ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
+                   is_gimple_reg, fb_rvalue);
+      recalculate_side_effects (*expr_p);
+      break;
+
+      /* Constants need not be gimplified.  */
+    case INTEGER_CST:
+    case REAL_CST:
+    case FIXED_CST:
+    case STRING_CST:
+    case COMPLEX_CST:
+    case VECTOR_CST:
+      ret = GS_ALL_DONE;
+      break;
+
+    case CONST_DECL:
+      /* If we require an lvalue, such as for ADDR_EXPR, retain the
+         CONST_DECL node.  Otherwise the decl is replaceable by its
+         value.  */
+      /* ??? Should be == fb_lvalue, but ADDR_EXPR passes fb_either.  */
+      if (fallback & fb_lvalue)
+        ret = GS_ALL_DONE;
+      else
+        *expr_p = DECL_INITIAL (*expr_p);
+      break;
+
+    case DECL_EXPR:
+      ret = gimplify_decl_expr (expr_p, pre_p);
+      break;
+
+    case BIND_EXPR:
+      ret = gimplify_bind_expr (expr_p, pre_p);
+      break;
+
+    case LOOP_EXPR:
+      ret = gimplify_loop_expr (expr_p, pre_p);
+      break;
+
+    case SWITCH_EXPR:
+      ret = gimplify_switch_expr (expr_p, pre_p);
+      break;
+
+    case EXIT_EXPR:
+      ret = gimplify_exit_expr (expr_p);
+      break;
+
+    case GOTO_EXPR:
+      /* If the target is not LABEL, then it is a computed jump
+         and the target needs to be gimplified.  */
+      if (TREE_CODE (GOTO_DESTINATION (*expr_p)) != LABEL_DECL)
+        {
+          ret = gimplify_expr (&GOTO_DESTINATION (*expr_p), pre_p,
+                   NULL, is_gimple_val, fb_rvalue);
+          if (ret == GS_ERROR)
+        break;
+        }
+      gimplify_seq_add_stmt (pre_p,
+              gimple_build_goto (GOTO_DESTINATION (*expr_p)));
+      break;
+
+    case PREDICT_EXPR:
+      gimplify_seq_add_stmt (pre_p,
+            gimple_build_predict (PREDICT_EXPR_PREDICTOR (*expr_p),
+                          PREDICT_EXPR_OUTCOME (*expr_p)));
+      ret = GS_ALL_DONE;
+      break;
+
+    case LABEL_EXPR:
+      ret = GS_ALL_DONE;
+      gcc_assert (decl_function_context (LABEL_EXPR_LABEL (*expr_p))
+              == current_function_decl);
+      gimplify_seq_add_stmt (pre_p,
+              gimple_build_label (LABEL_EXPR_LABEL (*expr_p)));
+      break;
+
+    case CASE_LABEL_EXPR:
+      ret = gimplify_case_label_expr (expr_p, pre_p);
+      break;
+
+    case RETURN_EXPR:
+      ret = gimplify_return_expr (*expr_p, pre_p);
+      break;
+
+    case CONSTRUCTOR:
+      /* Don't reduce this in place; let gimplify_init_constructor work its
+         magic.  Buf if we're just elaborating this for side effects, just
+         gimplify any element that has side-effects.  */
+      if (fallback == fb_none)
+        {
+          unsigned HOST_WIDE_INT ix;
+          constructor_elt *ce;
+          tree temp = NULL_TREE;
+          for (ix = 0;
+           VEC_iterate (constructor_elt, CONSTRUCTOR_ELTS (*expr_p),
+                ix, ce);
+           ix++)
+        if (TREE_SIDE_EFFECTS (ce->value))
+          append_to_statement_list (ce->value, &temp);
+
+          *expr_p = temp;
+          ret = GS_OK;
+        }
+      /* C99 code may assign to an array in a constructed
+         structure or union, and this has undefined behavior only
+         on execution, so create a temporary if an lvalue is
+         required.  */
+      else if (fallback == fb_lvalue)
+        {
+          *expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p);
+          mark_addressable (*expr_p);
+        }
+      else
+        ret = GS_ALL_DONE;
+      break;
+
+      /* The following are special cases that are not handled by the
+         original GIMPLE grammar.  */
+
+      /* SAVE_EXPR nodes are converted into a GIMPLE identifier and
+         eliminated.  */
+    case SAVE_EXPR:
+      ret = gimplify_save_expr (expr_p, pre_p, post_p);
+      break;
+
+    case BIT_FIELD_REF:
+      {
+        enum gimplify_status r0, r1, r2;
+
+        r0 = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,
+                post_p, is_gimple_lvalue, fb_either);
+        r1 = gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p,
+                post_p, is_gimple_val, fb_rvalue);
+        r2 = gimplify_expr (&TREE_OPERAND (*expr_p, 2), pre_p,
+                post_p, is_gimple_val, fb_rvalue);
+        recalculate_side_effects (*expr_p);
+
+        ret = MIN (r0, MIN (r1, r2));
+      }
+      break;
+
+    case TARGET_MEM_REF:
+      {
+        enum gimplify_status r0 = GS_ALL_DONE, r1 = GS_ALL_DONE;
+
+        if (TMR_SYMBOL (*expr_p))
+          r0 = gimplify_expr (&TMR_SYMBOL (*expr_p), pre_p,
+                  post_p, is_gimple_lvalue, fb_either);
+        else if (TMR_BASE (*expr_p))
+          r0 = gimplify_expr (&TMR_BASE (*expr_p), pre_p,
+                  post_p, is_gimple_val, fb_either);
+        if (TMR_INDEX (*expr_p))
+          r1 = gimplify_expr (&TMR_INDEX (*expr_p), pre_p,
+                  post_p, is_gimple_val, fb_rvalue);
+        /* TMR_STEP and TMR_OFFSET are always integer constants.  */
+        ret = MIN (r0, r1);
+      }
+      break;
+
+    case NON_LVALUE_EXPR:
+      /* This should have been stripped above.  */
+      gcc_unreachable ();
+
+    case ASM_EXPR:
+      ret = gimplify_asm_expr (expr_p, pre_p, post_p);
+      break;
+
+    case TRY_FINALLY_EXPR:
+    case TRY_CATCH_EXPR:
+      {
+        gimple_seq eval, cleanup;
+        gimple try_;
+
+        eval = cleanup = NULL;
+        gimplify_and_add (TREE_OPERAND (*expr_p, 0), &eval);
+        gimplify_and_add (TREE_OPERAND (*expr_p, 1), &cleanup);
+        /* Don't create bogus GIMPLE_TRY with empty cleanup.  */
+        if (gimple_seq_empty_p (cleanup))
+          {
+        gimple_seq_add_seq (pre_p, eval);
+        ret = GS_ALL_DONE;
+        break;
+          }
+        try_ = gimple_build_try (eval, cleanup,
+                     TREE_CODE (*expr_p) == TRY_FINALLY_EXPR
+                     ? GIMPLE_TRY_FINALLY
+                     : GIMPLE_TRY_CATCH);
+        if (TREE_CODE (*expr_p) == TRY_CATCH_EXPR)
+          gimple_try_set_catch_is_cleanup (try_,
+                           TRY_CATCH_IS_CLEANUP (*expr_p));
+        gimplify_seq_add_stmt (pre_p, try_);
+        ret = GS_ALL_DONE;
+        break;
+      }
+
+    case CLEANUP_POINT_EXPR:
+      ret = gimplify_cleanup_point_expr (expr_p, pre_p);
+      break;
+
+    case TARGET_EXPR:
+      ret = gimplify_target_expr (expr_p, pre_p, post_p);
+      break;
+
+    case CATCH_EXPR:
+      {
+        gimple c;
+        gimple_seq handler = NULL;
+        gimplify_and_add (CATCH_BODY (*expr_p), &handler);
+        c = gimple_build_catch (CATCH_TYPES (*expr_p), handler);
+        gimplify_seq_add_stmt (pre_p, c);
+        ret = GS_ALL_DONE;
+        break;
+      }
+
+    case EH_FILTER_EXPR:
+      {
+        gimple ehf;
+        gimple_seq failure = NULL;
+
+        gimplify_and_add (EH_FILTER_FAILURE (*expr_p), &failure);
+        ehf = gimple_build_eh_filter (EH_FILTER_TYPES (*expr_p), failure);
+        gimple_set_no_warning (ehf, TREE_NO_WARNING (*expr_p));
+        gimplify_seq_add_stmt (pre_p, ehf);
+        ret = GS_ALL_DONE;
+        break;
+      }
+
+    case OBJ_TYPE_REF:
+      {
+        enum gimplify_status r0, r1;
+        r0 = gimplify_expr (&OBJ_TYPE_REF_OBJECT (*expr_p), pre_p,
+                post_p, is_gimple_val, fb_rvalue);
+        r1 = gimplify_expr (&OBJ_TYPE_REF_EXPR (*expr_p), pre_p,
+                post_p, is_gimple_val, fb_rvalue);
+        TREE_SIDE_EFFECTS (*expr_p) = 0;
+        ret = MIN (r0, r1);
+      }
+      break;
+
+    case LABEL_DECL:
+      /* We get here when taking the address of a label.  We mark
+         the label as "forced"; meaning it can never be removed and
+         it is a potential target for any computed goto.  */
+      FORCED_LABEL (*expr_p) = 1;
+      ret = GS_ALL_DONE;
+      break;
+
+    case STATEMENT_LIST:
+      ret = gimplify_statement_list (expr_p, pre_p);
+      break;
+
+    case WITH_SIZE_EXPR:
+      {
+        gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,
+               post_p == &internal_post ? NULL : post_p,
+               gimple_test_f, fallback);
+        gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p, post_p,
+               is_gimple_val, fb_rvalue);
+      }
+      break;
+
+    case VAR_DECL:
+    case PARM_DECL:
+      ret = gimplify_var_or_parm_decl (expr_p);
+      break;
+
+    case RESULT_DECL:
+      /* When within an OpenMP context, notice uses of variables.  */
+      if (gimplify_omp_ctxp)
+        omp_notice_variable (gimplify_omp_ctxp, *expr_p, true);
+      ret = GS_ALL_DONE;
+      break;
+
+    case SSA_NAME:
+      /* Allow callbacks into the gimplifier during optimization.  */
+      ret = GS_ALL_DONE;
+      break;
+
+    case OMP_PARALLEL:
+      gimplify_omp_parallel (expr_p, pre_p);
+      ret = GS_ALL_DONE;
+      break;
+
+    case OMP_TASK:
+      gimplify_omp_task (expr_p, pre_p);
+      ret = GS_ALL_DONE;
+      break;
+
+    case OMP_FOR:
+      ret = gimplify_omp_for (expr_p, pre_p);
+      break;
+
+    case OMP_SECTIONS:
+    case OMP_SINGLE:
+      gimplify_omp_workshare (expr_p, pre_p);
+      ret = GS_ALL_DONE;
+      break;
+
+    case OMP_SECTION:
+    case OMP_MASTER:
+    case OMP_ORDERED:
+    case OMP_CRITICAL:
+      {
+        gimple_seq body = NULL;
+        gimple g;
+
+        gimplify_and_add (OMP_BODY (*expr_p), &body);
+        switch (TREE_CODE (*expr_p))
+          {
+          case OMP_SECTION:
+            g = gimple_build_omp_section (body);
+            break;
+          case OMP_MASTER:
+            g = gimple_build_omp_master (body);
+        break;
+          case OMP_ORDERED:
+        g = gimple_build_omp_ordered (body);
+        break;
+          case OMP_CRITICAL:
+        g = gimple_build_omp_critical (body,
+                               OMP_CRITICAL_NAME (*expr_p));
+        break;
+          default:
+        gcc_unreachable ();
+          }
+        gimplify_seq_add_stmt (pre_p, g);
+        ret = GS_ALL_DONE;
+        break;
+      }
+
+    case OMP_ATOMIC:
+      ret = gimplify_omp_atomic (expr_p, pre_p);
+      break;
+
+    case POINTER_PLUS_EXPR:
           /* Convert ((type *)A)+offset into &A->field_of_type_and_offset.
-	     The second is gimple immediate saving a need for extra statement.
-	   */
-	  if (TREE_CODE (TREE_OPERAND (*expr_p, 1)) == INTEGER_CST
-	      && (tmp = maybe_fold_offset_to_address
-			 (TREE_OPERAND (*expr_p, 0), TREE_OPERAND (*expr_p, 1),
-		   	  TREE_TYPE (*expr_p))))
-	    {
-	      *expr_p = tmp;
-	      break;
-	    }
-	  /* Convert (void *)&a + 4 into (void *)&a[1].  */
-	  if (TREE_CODE (TREE_OPERAND (*expr_p, 0)) == NOP_EXPR
-	      && TREE_CODE (TREE_OPERAND (*expr_p, 1)) == INTEGER_CST
-	      && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (*expr_p,
-									0),0)))
-	      && (tmp = maybe_fold_offset_to_address
-			 (TREE_OPERAND (TREE_OPERAND (*expr_p, 0), 0),
-			  TREE_OPERAND (*expr_p, 1),
-		   	  TREE_TYPE (TREE_OPERAND (TREE_OPERAND (*expr_p, 0),
-						   0)))))
-	     {
+         The second is gimple immediate saving a need for extra statement.
+       */
+      if (TREE_CODE (TREE_OPERAND (*expr_p, 1)) == INTEGER_CST
+          && (tmp = maybe_fold_offset_to_address
+          (EXPR_LOCATION (*expr_p),
+           TREE_OPERAND (*expr_p, 0), TREE_OPERAND (*expr_p, 1),
+           TREE_TYPE (*expr_p))))
+        {
+          *expr_p = tmp;
+          break;
+        }
+      /* Convert (void *)&a + 4 into (void *)&a[1].  */
+      if (TREE_CODE (TREE_OPERAND (*expr_p, 0)) == NOP_EXPR
+          && TREE_CODE (TREE_OPERAND (*expr_p, 1)) == INTEGER_CST
+          && POINTER_TYPE_P (TREE_TYPE (TREE_OPERAND (TREE_OPERAND (*expr_p,
+                                    0),0)))
+          && (tmp = maybe_fold_offset_to_address
+          (EXPR_LOCATION (*expr_p),
+           TREE_OPERAND (TREE_OPERAND (*expr_p, 0), 0),
+           TREE_OPERAND (*expr_p, 1),
+           TREE_TYPE (TREE_OPERAND (TREE_OPERAND (*expr_p, 0),
+                        0)))))
+         {
                *expr_p = fold_convert (TREE_TYPE (*expr_p), tmp);
-	       break;
-	     }
+           break;
+         }
           /* FALLTHRU */
 
-	default:
-	  switch (TREE_CODE_CLASS (TREE_CODE (*expr_p)))
-	    {
-	    case tcc_comparison:
-	      /* Handle comparison of objects of non scalar mode aggregates
-	     	 with a call to memcmp.  It would be nice to only have to do
-	     	 this for variable-sized objects, but then we'd have to allow
-	     	 the same nest of reference nodes we allow for MODIFY_EXPR and
-	     	 that's too complex.
-
-		 Compare scalar mode aggregates as scalar mode values.  Using
-		 memcmp for them would be very inefficient at best, and is
-		 plain wrong if bitfields are involved.  */
-		{
-		  tree type = TREE_TYPE (TREE_OPERAND (*expr_p, 1));
-
-		  if (!AGGREGATE_TYPE_P (type))
-		    goto expr_2;
-		  else if (TYPE_MODE (type) != BLKmode)
-		    ret = gimplify_scalar_mode_aggregate_compare (expr_p);
-		  else
-		    ret = gimplify_variable_sized_compare (expr_p);
-
-		  break;
-		}
-
-	    /* If *EXPR_P does not need to be special-cased, handle it
-	       according to its class.  */
-	    case tcc_unary:
-	      ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,
-				   post_p, is_gimple_val, fb_rvalue);
-	      break;
-
-	    case tcc_binary:
-	    expr_2:
-	      {
-		enum gimplify_status r0, r1;
-
-		r0 = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,
-		                    post_p, is_gimple_val, fb_rvalue);
-		r1 = gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p,
-				    post_p, is_gimple_val, fb_rvalue);
-
-		ret = MIN (r0, r1);
-		break;
-	      }
-
-	    case tcc_declaration:
-	    case tcc_constant:
-	      ret = GS_ALL_DONE;
-	      goto dont_recalculate;
-
-	    default:
-	      gcc_assert (TREE_CODE (*expr_p) == TRUTH_AND_EXPR
-			  || TREE_CODE (*expr_p) == TRUTH_OR_EXPR
-			  || TREE_CODE (*expr_p) == TRUTH_XOR_EXPR);
-	      goto expr_2;
-	    }
-
-	  recalculate_side_effects (*expr_p);
-
-	dont_recalculate:
-	  break;
-	}
+    default:
+      switch (TREE_CODE_CLASS (TREE_CODE (*expr_p)))
+        {
+        case tcc_comparison:
+          /* Handle comparison of objects of non scalar mode aggregates
+             with a call to memcmp.  It would be nice to only have to do
+             this for variable-sized objects, but then we'd have to allow
+             the same nest of reference nodes we allow for MODIFY_EXPR and
+             that's too complex.
+
+         Compare scalar mode aggregates as scalar mode values.  Using
+         memcmp for them would be very inefficient at best, and is
+         plain wrong if bitfields are involved.  */
+        {
+          tree type = TREE_TYPE (TREE_OPERAND (*expr_p, 1));
+
+          if (!AGGREGATE_TYPE_P (type))
+            goto expr_2;
+          else if (TYPE_MODE (type) != BLKmode)
+            ret = gimplify_scalar_mode_aggregate_compare (expr_p);
+          else
+            ret = gimplify_variable_sized_compare (expr_p);
+
+          break;
+        }
+
+        /* If *EXPR_P does not need to be special-cased, handle it
+           according to its class.  */
+        case tcc_unary:
+          ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,
+                   post_p, is_gimple_val, fb_rvalue);
+          break;
+
+        case tcc_binary:
+        expr_2:
+          {
+        enum gimplify_status r0, r1;
+
+        r0 = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p,
+                            post_p, is_gimple_val, fb_rvalue);
+        r1 = gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p,
+                    post_p, is_gimple_val, fb_rvalue);
+
+        ret = MIN (r0, r1);
+        break;
+          }
+
+        case tcc_declaration:
+        case tcc_constant:
+          ret = GS_ALL_DONE;
+          goto dont_recalculate;
+
+        default:
+          gcc_assert (TREE_CODE (*expr_p) == TRUTH_AND_EXPR
+              || TREE_CODE (*expr_p) == TRUTH_OR_EXPR
+              || TREE_CODE (*expr_p) == TRUTH_XOR_EXPR);
+          goto expr_2;
+        }
+
+      recalculate_side_effects (*expr_p);
+
+    dont_recalculate:
+      break;
+    }
 
       /* If we replaced *expr_p, gimplify again.  */
       if (ret == GS_OK && (*expr_p == NULL || *expr_p == save_expr))
-	ret = GS_ALL_DONE;
+    ret = GS_ALL_DONE;
     }
   while (ret == GS_OK);
 
@@ -6923,7 +7022,7 @@
   if (ret == GS_ERROR)
     {
       if (is_statement)
-	*expr_p = NULL;
+    *expr_p = NULL;
       goto out;
     }
 
@@ -6934,67 +7033,67 @@
   if (fallback == fb_none && *expr_p && !is_gimple_stmt (*expr_p))
     {
       /* We aren't looking for a value, and we don't have a valid
-	 statement.  If it doesn't have side-effects, throw it away.  */
+     statement.  If it doesn't have side-effects, throw it away.  */
       if (!TREE_SIDE_EFFECTS (*expr_p))
-	*expr_p = NULL;
+    *expr_p = NULL;
       else if (!TREE_THIS_VOLATILE (*expr_p))
-	{
-	  /* This is probably a _REF that contains something nested that
-	     has side effects.  Recurse through the operands to find it.  */
-	  enum tree_code code = TREE_CODE (*expr_p);
-
-	  switch (code)
-	    {
-	    case COMPONENT_REF:
-	    case REALPART_EXPR:
-	    case IMAGPART_EXPR:
-	    case VIEW_CONVERT_EXPR:
-	      gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
-			     gimple_test_f, fallback);
-	      break;
-
-	    case ARRAY_REF:
-	    case ARRAY_RANGE_REF:
-	      gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
-			     gimple_test_f, fallback);
-	      gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p, post_p,
-			     gimple_test_f, fallback);
-	      break;
-
-	    default:
-	       /* Anything else with side-effects must be converted to
-		  a valid statement before we get here.  */
-	      gcc_unreachable ();
-	    }
-
-	  *expr_p = NULL;
-	}
+    {
+      /* This is probably a _REF that contains something nested that
+         has side effects.  Recurse through the operands to find it.  */
+      enum tree_code code = TREE_CODE (*expr_p);
+
+      switch (code)
+        {
+        case COMPONENT_REF:
+        case REALPART_EXPR:
+        case IMAGPART_EXPR:
+        case VIEW_CONVERT_EXPR:
+          gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
+                 gimple_test_f, fallback);
+          break;
+
+        case ARRAY_REF:
+        case ARRAY_RANGE_REF:
+          gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p,
+                 gimple_test_f, fallback);
+          gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p, post_p,
+                 gimple_test_f, fallback);
+          break;
+
+        default:
+           /* Anything else with side-effects must be converted to
+          a valid statement before we get here.  */
+          gcc_unreachable ();
+        }
+
+      *expr_p = NULL;
+    }
       else if (COMPLETE_TYPE_P (TREE_TYPE (*expr_p))
-	       && TYPE_MODE (TREE_TYPE (*expr_p)) != BLKmode)
-	{
-	  /* Historically, the compiler has treated a bare reference
-	     to a non-BLKmode volatile lvalue as forcing a load.  */
-	  tree type = TYPE_MAIN_VARIANT (TREE_TYPE (*expr_p));
-
-	  /* Normally, we do not want to create a temporary for a
-	     TREE_ADDRESSABLE type because such a type should not be
-	     copied by bitwise-assignment.  However, we make an
-	     exception here, as all we are doing here is ensuring that
-	     we read the bytes that make up the type.  We use
-	     create_tmp_var_raw because create_tmp_var will abort when
-	     given a TREE_ADDRESSABLE type.  */
-	  tree tmp = create_tmp_var_raw (type, "vol");
-	  gimple_add_tmp_var (tmp);
-	  gimplify_assign (tmp, *expr_p, pre_p);
-	  *expr_p = NULL;
-	}
+           && TYPE_MODE (TREE_TYPE (*expr_p)) != BLKmode)
+    {
+      /* Historically, the compiler has treated a bare reference
+         to a non-BLKmode volatile lvalue as forcing a load.  */
+      tree type = TYPE_MAIN_VARIANT (TREE_TYPE (*expr_p));
+
+      /* Normally, we do not want to create a temporary for a
+         TREE_ADDRESSABLE type because such a type should not be
+         copied by bitwise-assignment.  However, we make an
+         exception here, as all we are doing here is ensuring that
+         we read the bytes that make up the type.  We use
+         create_tmp_var_raw because create_tmp_var will abort when
+         given a TREE_ADDRESSABLE type.  */
+      tree tmp = create_tmp_var_raw (type, "vol");
+      gimple_add_tmp_var (tmp);
+      gimplify_assign (tmp, *expr_p, pre_p);
+      *expr_p = NULL;
+    }
       else
-	/* We can't do anything useful with a volatile reference to
-	   an incomplete type, so just throw it away.  Likewise for
-	   a BLKmode type, since any implicit inner load should
-	   already have been turned into an explicit one by the
-	   gimplification process.  */
-	*expr_p = NULL;
+    /* We can't do anything useful with a volatile reference to
+       an incomplete type, so just throw it away.  Likewise for
+       a BLKmode type, since any implicit inner load should
+       already have been turned into an explicit one by the
+       gimplification process.  */
+    *expr_p = NULL;
     }
 
   /* If we are gimplifying at the statement level, we're done.  Tack
@@ -7006,22 +7105,22 @@
       *expr_p = NULL_TREE;
 
       if (!gimple_seq_empty_p (internal_pre)
-	  || !gimple_seq_empty_p (internal_post))
-	{
-	  gimplify_seq_add_seq (&internal_pre, internal_post);
-	  gimplify_seq_add_seq (pre_p, internal_pre);
-	}
+      || !gimple_seq_empty_p (internal_post))
+    {
+      gimplify_seq_add_seq (&internal_pre, internal_post);
+      gimplify_seq_add_seq (pre_p, internal_pre);
+    }
 
       /* The result of gimplifying *EXPR_P is going to be the last few
-	 statements in *PRE_P and *POST_P.  Add location information
-	 to all the statements that were added by the gimplification
-	 helpers.  */
+     statements in *PRE_P and *POST_P.  Add location information
+     to all the statements that were added by the gimplification
+     helpers.  */
       if (!gimple_seq_empty_p (*pre_p))
-	annotate_all_with_location_after (*pre_p, pre_last_gsi, input_location);
+    annotate_all_with_location_after (*pre_p, pre_last_gsi, input_location);
 
       if (!gimple_seq_empty_p (*post_p))
-	annotate_all_with_location_after (*post_p, post_last_gsi,
-					  input_location);
+    annotate_all_with_location_after (*post_p, post_last_gsi,
+                      input_location);
 
       goto out;
     }
@@ -7032,25 +7131,24 @@
       enum tree_code code = TREE_CODE (*expr_p);
       /* These expressions should already be in gimple IR form.  */
       gcc_assert (code != MODIFY_EXPR
-		  && code != ASM_EXPR
-		  && code != BIND_EXPR
-		  && code != CATCH_EXPR
-		  && (code != COND_EXPR || gimplify_ctxp->allow_rhs_cond_expr)
-		  && code != EH_FILTER_EXPR
-		  && code != GOTO_EXPR
-		  && code != LABEL_EXPR
-		  && code != LOOP_EXPR
-		  && code != RESX_EXPR
-		  && code != SWITCH_EXPR
-		  && code != TRY_FINALLY_EXPR
-		  && code != OMP_CRITICAL
-		  && code != OMP_FOR
-		  && code != OMP_MASTER
-		  && code != OMP_ORDERED
-		  && code != OMP_PARALLEL
-		  && code != OMP_SECTIONS
-		  && code != OMP_SECTION
-		  && code != OMP_SINGLE);
+          && code != ASM_EXPR
+          && code != BIND_EXPR
+          && code != CATCH_EXPR
+          && (code != COND_EXPR || gimplify_ctxp->allow_rhs_cond_expr)
+          && code != EH_FILTER_EXPR
+          && code != GOTO_EXPR
+          && code != LABEL_EXPR
+          && code != LOOP_EXPR
+          && code != SWITCH_EXPR
+          && code != TRY_FINALLY_EXPR
+          && code != OMP_CRITICAL
+          && code != OMP_FOR
+          && code != OMP_MASTER
+          && code != OMP_ORDERED
+          && code != OMP_PARALLEL
+          && code != OMP_SECTIONS
+          && code != OMP_SECTION
+          && code != OMP_SINGLE);
     }
 #endif
 
@@ -7074,47 +7172,49 @@
       && is_gimple_addressable (*expr_p))
     {
       /* An lvalue will do.  Take the address of the expression, store it
-	 in a temporary, and replace the expression with an INDIRECT_REF of
-	 that temporary.  */
-      tmp = build_fold_addr_expr (*expr_p);
+     in a temporary, and replace the expression with an INDIRECT_REF of
+     that temporary.  */
+      tmp = build_fold_addr_expr_loc (input_location, *expr_p);
       gimplify_expr (&tmp, pre_p, post_p, is_gimple_reg, fb_rvalue);
       *expr_p = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (tmp)), tmp);
     }
-  else if ((fallback & fb_rvalue) && is_gimple_formal_tmp_or_call_rhs (*expr_p))
+  else if ((fallback & fb_rvalue) && is_gimple_reg_rhs_or_call (*expr_p))
     {
       /* An rvalue will do.  Assign the gimplified expression into a
-	 new temporary TMP and replace the original expression with
-	 TMP.  First, make sure that the expression has a type so that
-	 it can be assigned into a temporary.  */
+     new temporary TMP and replace the original expression with
+     TMP.  First, make sure that the expression has a type so that
+     it can be assigned into a temporary.  */
       gcc_assert (!VOID_TYPE_P (TREE_TYPE (*expr_p)));
 
       if (!gimple_seq_empty_p (internal_post) || (fallback & fb_lvalue))
-	/* The postqueue might change the value of the expression between
-	   the initialization and use of the temporary, so we can't use a
-	   formal temp.  FIXME do we care?  */
-	*expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p);
+    /* The postqueue might change the value of the expression between
+       the initialization and use of the temporary, so we can't use a
+       formal temp.  FIXME do we care?  */
+    {
+      *expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p);
+      if (TREE_CODE (TREE_TYPE (*expr_p)) == COMPLEX_TYPE
+          || TREE_CODE (TREE_TYPE (*expr_p)) == VECTOR_TYPE)
+        DECL_GIMPLE_REG_P (*expr_p) = 1;
+    }
       else
-	*expr_p = get_formal_tmp_var (*expr_p, pre_p);
-
-      if (TREE_CODE (*expr_p) != SSA_NAME)
-	DECL_GIMPLE_FORMAL_TEMP_P (*expr_p) = 1;
+    *expr_p = get_formal_tmp_var (*expr_p, pre_p);
     }
   else
     {
 #ifdef ENABLE_GIMPLE_CHECKING
       if (!(fallback & fb_mayfail))
-	{
-	  fprintf (stderr, "gimplification failed:\n");
-	  print_generic_expr (stderr, *expr_p, 0);
-	  debug_tree (*expr_p);
-	  internal_error ("gimplification failed");
-	}
+    {
+      fprintf (stderr, "gimplification failed:\n");
+      print_generic_expr (stderr, *expr_p, 0);
+      debug_tree (*expr_p);
+      internal_error ("gimplification failed");
+    }
 #endif
       gcc_assert (fallback & fb_mayfail);
 
       /* If this is an asm statement, and the user asked for the
-	 impossible, don't die.  Fail and let gimplify_asm_expr
-	 issue an error.  */
+     impossible, don't die.  Fail and let gimplify_asm_expr
+     issue an error.  */
       ret = GS_ERROR;
       goto out;
     }
@@ -7164,10 +7264,10 @@
       gimplify_one_sizepos (&TYPE_MAX_VALUE (type), list_p);
 
       for (t = TYPE_NEXT_VARIANT (type); t; t = TYPE_NEXT_VARIANT (t))
-	{
-	  TYPE_MIN_VALUE (t) = TYPE_MIN_VALUE (type);
-	  TYPE_MAX_VALUE (t) = TYPE_MAX_VALUE (type);
-	}
+    {
+      TYPE_MIN_VALUE (t) = TYPE_MIN_VALUE (type);
+      TYPE_MAX_VALUE (t) = TYPE_MAX_VALUE (type);
+    }
       break;
 
     case ARRAY_TYPE:
@@ -7176,45 +7276,45 @@
       gimplify_type_sizes (TYPE_DOMAIN (type), list_p);
       /* When not optimizing, ensure VLA bounds aren't removed.  */
       if (!optimize
-	  && TYPE_DOMAIN (type)
-	  && INTEGRAL_TYPE_P (TYPE_DOMAIN (type)))
-	{
-	  t = TYPE_MIN_VALUE (TYPE_DOMAIN (type));
-	  if (t && TREE_CODE (t) == VAR_DECL && DECL_ARTIFICIAL (t))
-	    DECL_IGNORED_P (t) = 0;
-	  t = TYPE_MAX_VALUE (TYPE_DOMAIN (type));
-	  if (t && TREE_CODE (t) == VAR_DECL && DECL_ARTIFICIAL (t))
-	    DECL_IGNORED_P (t) = 0;
-	}
+      && TYPE_DOMAIN (type)
+      && INTEGRAL_TYPE_P (TYPE_DOMAIN (type)))
+    {
+      t = TYPE_MIN_VALUE (TYPE_DOMAIN (type));
+      if (t && TREE_CODE (t) == VAR_DECL && DECL_ARTIFICIAL (t))
+        DECL_IGNORED_P (t) = 0;
+      t = TYPE_MAX_VALUE (TYPE_DOMAIN (type));
+      if (t && TREE_CODE (t) == VAR_DECL && DECL_ARTIFICIAL (t))
+        DECL_IGNORED_P (t) = 0;
+    }
       break;
 
     case RECORD_TYPE:
     case UNION_TYPE:
     case QUAL_UNION_TYPE:
       for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
-	if (TREE_CODE (field) == FIELD_DECL)
-	  {
-	    gimplify_one_sizepos (&DECL_FIELD_OFFSET (field), list_p);
-	    gimplify_one_sizepos (&DECL_SIZE (field), list_p);
-	    gimplify_one_sizepos (&DECL_SIZE_UNIT (field), list_p);
-	    gimplify_type_sizes (TREE_TYPE (field), list_p);
-	  }
+    if (TREE_CODE (field) == FIELD_DECL)
+      {
+        gimplify_one_sizepos (&DECL_FIELD_OFFSET (field), list_p);
+        gimplify_one_sizepos (&DECL_SIZE (field), list_p);
+        gimplify_one_sizepos (&DECL_SIZE_UNIT (field), list_p);
+        gimplify_type_sizes (TREE_TYPE (field), list_p);
+      }
       break;
 
     case POINTER_TYPE:
     case REFERENCE_TYPE:
-	/* We used to recurse on the pointed-to type here, which turned out to
-	   be incorrect because its definition might refer to variables not
-	   yet initialized at this point if a forward declaration is involved.
-
-	   It was actually useful for anonymous pointed-to types to ensure
-	   that the sizes evaluation dominates every possible later use of the
-	   values.  Restricting to such types here would be safe since there
-	   is no possible forward declaration around, but would introduce an
-	   undesirable middle-end semantic to anonymity.  We then defer to
-	   front-ends the responsibility of ensuring that the sizes are
-	   evaluated both early and late enough, e.g. by attaching artificial
-	   type declarations to the tree.  */
+    /* We used to recurse on the pointed-to type here, which turned out to
+       be incorrect because its definition might refer to variables not
+       yet initialized at this point if a forward declaration is involved.
+
+       It was actually useful for anonymous pointed-to types to ensure
+       that the sizes evaluation dominates every possible later use of the
+       values.  Restricting to such types here would be safe since there
+       is no possible forward declaration around, but would introduce an
+       undesirable middle-end semantic to anonymity.  We then defer to
+       front-ends the responsibility of ensuring that the sizes are
+       evaluated both early and late enough, e.g. by attaching artificial
+       type declarations to the tree.  */
       break;
 
     default:
@@ -7274,9 +7374,9 @@
       tmp = build1 (NOP_EXPR, type, expr);
       stmt = gimplify_assign (*expr_p, tmp, stmt_p);
       if (EXPR_HAS_LOCATION (expr))
-	gimple_set_location (stmt, *EXPR_LOCUS (expr));
+    gimple_set_location (stmt, EXPR_LOCATION (expr));
       else
-	gimple_set_location (stmt, input_location);
+    gimple_set_location (stmt, input_location);
     }
 }
 
@@ -7310,6 +7410,9 @@
   unshare_body (body_p, fndecl);
   unvisit_body (body_p, fndecl);
 
+  if (cgraph_node (fndecl)->origin)
+    nonlocal_vlas = pointer_set_create ();
+
   /* Make sure input_location isn't set to something weird.  */
   input_location = DECL_SOURCE_LOCATION (fndecl);
 
@@ -7345,6 +7448,12 @@
       gimple_bind_set_body (outer_bind, parm_stmts);
     }
 
+  if (nonlocal_vlas)
+    {
+      pointer_set_destroy (nonlocal_vlas);
+      nonlocal_vlas = NULL;
+    }
+
   pop_gimplify_context (outer_bind);
   gcc_assert (gimplify_ctxp == NULL);
 
@@ -7361,7 +7470,7 @@
 
 /* Entry point to the gimplification pass.  FNDECL is the FUNCTION_DECL
    node for the function we want to gimplify.
-   
+
    Returns the sequence of GIMPLE statements corresponding to the body
    of FNDECL.  */
 
@@ -7372,6 +7481,8 @@
   gimple_seq seq;
   gimple bind;
 
+  gcc_assert (!gimple_body (fndecl));
+
   oldfn = current_function_decl;
   current_function_decl = fndecl;
   if (DECL_STRUCT_FUNCTION (fndecl))
@@ -7385,7 +7496,7 @@
          for promotion to gimple registers.  We'll transform their uses
          as we find them.  */
       if ((TREE_CODE (TREE_TYPE (parm)) == COMPLEX_TYPE
-	   || TREE_CODE (TREE_TYPE (parm)) == VECTOR_TYPE)
+       || TREE_CODE (TREE_TYPE (parm)) == VECTOR_TYPE)
           && !TREE_THIS_VOLATILE (parm)
           && !needs_to_live_in_memory (parm))
         DECL_GIMPLE_REG_P (parm) = 1;
@@ -7438,6 +7549,7 @@
     }
 
   DECL_SAVED_TREE (fndecl) = NULL_TREE;
+  cfun->curr_properties = PROP_gimple_any;
 
   current_function_decl = oldfn;
   pop_cfun ();
@@ -7465,161 +7577,153 @@
     {
     case GIMPLE_COND:
       gimplify_expr (gimple_cond_lhs_ptr (stmt), &pre, NULL,
-		     is_gimple_val, fb_rvalue);
+             is_gimple_val, fb_rvalue);
       gimplify_expr (gimple_cond_rhs_ptr (stmt), &pre, NULL,
-		     is_gimple_val, fb_rvalue);
+             is_gimple_val, fb_rvalue);
       break;
     case GIMPLE_SWITCH:
       gimplify_expr (gimple_switch_index_ptr (stmt), &pre, NULL,
-		     is_gimple_val, fb_rvalue);
+             is_gimple_val, fb_rvalue);
       break;
     case GIMPLE_OMP_ATOMIC_LOAD:
       gimplify_expr (gimple_omp_atomic_load_rhs_ptr (stmt), &pre, NULL,
-		     is_gimple_val, fb_rvalue);
+             is_gimple_val, fb_rvalue);
       break;
     case GIMPLE_ASM:
       {
-	size_t i, noutputs = gimple_asm_noutputs (stmt);
-	const char *constraint, **oconstraints;
-	bool allows_mem, allows_reg, is_inout;
-
-	oconstraints
-	  = (const char **) alloca ((noutputs) * sizeof (const char *));
-	for (i = 0; i < noutputs; i++)
-	  {
-	    tree op = gimple_asm_output_op (stmt, i);
-	    constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op)));
-	    oconstraints[i] = constraint;
-	    parse_output_constraint (&constraint, i, 0, 0, &allows_mem,
-				     &allows_reg, &is_inout);
-	    gimplify_expr (&TREE_VALUE (op), &pre, NULL,
-			   is_inout ? is_gimple_min_lval : is_gimple_lvalue,
-			   fb_lvalue | fb_mayfail);
-	  }
-	for (i = 0; i < gimple_asm_ninputs (stmt); i++)
-	  {
-	    tree op = gimple_asm_input_op (stmt, i);
-	    constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op)));
-	    parse_input_constraint (&constraint, 0, 0, noutputs, 0,
-				    oconstraints, &allows_mem, &allows_reg);
-	    if (TREE_ADDRESSABLE (TREE_TYPE (TREE_VALUE (op))) && allows_mem)
-	      allows_reg = 0;
-	    if (!allows_reg && allows_mem)
-	      gimplify_expr (&TREE_VALUE (op), &pre, NULL,
-			     is_gimple_lvalue, fb_lvalue | fb_mayfail);
-	    else
-	      gimplify_expr (&TREE_VALUE (op), &pre, NULL,
-			     is_gimple_asm_val, fb_rvalue);
-	  }
+    size_t i, noutputs = gimple_asm_noutputs (stmt);
+    const char *constraint, **oconstraints;
+    bool allows_mem, allows_reg, is_inout;
+
+    oconstraints
+      = (const char **) alloca ((noutputs) * sizeof (const char *));
+    for (i = 0; i < noutputs; i++)
+      {
+        tree op = gimple_asm_output_op (stmt, i);
+        constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op)));
+        oconstraints[i] = constraint;
+        parse_output_constraint (&constraint, i, 0, 0, &allows_mem,
+                     &allows_reg, &is_inout);
+        gimplify_expr (&TREE_VALUE (op), &pre, NULL,
+               is_inout ? is_gimple_min_lval : is_gimple_lvalue,
+               fb_lvalue | fb_mayfail);
+      }
+    for (i = 0; i < gimple_asm_ninputs (stmt); i++)
+      {
+        tree op = gimple_asm_input_op (stmt, i);
+        constraint = TREE_STRING_POINTER (TREE_VALUE (TREE_PURPOSE (op)));
+        parse_input_constraint (&constraint, 0, 0, noutputs, 0,
+                    oconstraints, &allows_mem, &allows_reg);
+        if (TREE_ADDRESSABLE (TREE_TYPE (TREE_VALUE (op))) && allows_mem)
+          allows_reg = 0;
+        if (!allows_reg && allows_mem)
+          gimplify_expr (&TREE_VALUE (op), &pre, NULL,
+                 is_gimple_lvalue, fb_lvalue | fb_mayfail);
+        else
+          gimplify_expr (&TREE_VALUE (op), &pre, NULL,
+                 is_gimple_asm_val, fb_rvalue);
+      }
       }
       break;
     default:
       /* NOTE: We start gimplifying operands from last to first to
-	 make sure that side-effects on the RHS of calls, assignments
-	 and ASMs are executed before the LHS.  The ordering is not
-	 important for other statements.  */
+     make sure that side-effects on the RHS of calls, assignments
+     and ASMs are executed before the LHS.  The ordering is not
+     important for other statements.  */
       num_ops = gimple_num_ops (stmt);
       orig_lhs = gimple_get_lhs (stmt);
       for (i = num_ops; i > 0; i--)
-	{
-	  tree op = gimple_op (stmt, i - 1);
-	  if (op == NULL_TREE)
-	    continue;
-	  if (i == 1 && (is_gimple_call (stmt) || is_gimple_assign (stmt)))
-	    gimplify_expr (&op, &pre, NULL, is_gimple_lvalue, fb_lvalue);
-	  else if (i == 2
-		   && is_gimple_assign (stmt)
-		   && num_ops == 2
-		   && get_gimple_rhs_class (gimple_expr_code (stmt))
-		      == GIMPLE_SINGLE_RHS)
-	    gimplify_expr (&op, &pre, NULL,
-			   rhs_predicate_for (gimple_assign_lhs (stmt)),
-			   fb_rvalue);
-	  else if (i == 2 && is_gimple_call (stmt))
-	    {
-	      if (TREE_CODE (op) == FUNCTION_DECL)
-		continue;
-	      gimplify_expr (&op, &pre, NULL, is_gimple_call_addr, fb_rvalue);
-	    }
-	  else
-	    gimplify_expr (&op, &pre, NULL, is_gimple_val, fb_rvalue);
-	  gimple_set_op (stmt, i - 1, op);
-	}
+    {
+      tree op = gimple_op (stmt, i - 1);
+      if (op == NULL_TREE)
+        continue;
+      if (i == 1 && (is_gimple_call (stmt) || is_gimple_assign (stmt)))
+        gimplify_expr (&op, &pre, NULL, is_gimple_lvalue, fb_lvalue);
+      else if (i == 2
+           && is_gimple_assign (stmt)
+           && num_ops == 2
+           && get_gimple_rhs_class (gimple_expr_code (stmt))
+              == GIMPLE_SINGLE_RHS)
+        gimplify_expr (&op, &pre, NULL,
+               rhs_predicate_for (gimple_assign_lhs (stmt)),
+               fb_rvalue);
+      else if (i == 2 && is_gimple_call (stmt))
+        {
+          if (TREE_CODE (op) == FUNCTION_DECL)
+        continue;
+          gimplify_expr (&op, &pre, NULL, is_gimple_call_addr, fb_rvalue);
+        }
+      else
+        gimplify_expr (&op, &pre, NULL, is_gimple_val, fb_rvalue);
+      gimple_set_op (stmt, i - 1, op);
+    }
 
       lhs = gimple_get_lhs (stmt);
       /* If the LHS changed it in a way that requires a simple RHS,
-	 create temporary.  */
-      if (lhs && !is_gimple_formal_tmp_var (lhs))
-	{
-	  bool need_temp = false;
-
-	  if (is_gimple_assign (stmt)
-	      && num_ops == 2
-	      && get_gimple_rhs_class (gimple_expr_code (stmt))
-		 == GIMPLE_SINGLE_RHS)
-	    gimplify_expr (gimple_assign_rhs1_ptr (stmt), &pre, NULL,
-			   rhs_predicate_for (gimple_assign_lhs (stmt)),
-			   fb_rvalue);
-	  else if (is_gimple_reg (lhs))
-	    {
-	      if (is_gimple_reg_type (TREE_TYPE (lhs)))
-		{
-		  if (is_gimple_call (stmt))
-		    {
-		      i = gimple_call_flags (stmt);
-		      if ((i & ECF_LOOPING_CONST_OR_PURE)
-			  || !(i & (ECF_CONST | ECF_PURE)))
-			need_temp = true;
-		    }
-		  if (stmt_can_throw_internal (stmt))
-		    need_temp = true;
-		}
-	    }
-	  else
-	    {
-	      if (is_gimple_reg_type (TREE_TYPE (lhs)))
-		need_temp = true;
-	      else if (TYPE_MODE (TREE_TYPE (lhs)) != BLKmode)
-		{
-		  if (is_gimple_call (stmt))
-		    {
-		      tree fndecl = gimple_call_fndecl (stmt);
-
-		      if (!aggregate_value_p (TREE_TYPE (lhs), fndecl)
-			  && !(fndecl && DECL_RESULT (fndecl)
-			       && DECL_BY_REFERENCE (DECL_RESULT (fndecl))))
-			need_temp = true;
-		    }
-		  else
-		    need_temp = true;
-		}
-	    }
-	  if (need_temp)
-	    {
-	      tree temp = create_tmp_var (TREE_TYPE (lhs), NULL);
-
-	      DECL_GIMPLE_FORMAL_TEMP_P (temp) = 1;
-	      if (TREE_CODE (TREE_TYPE (lhs)) == COMPLEX_TYPE
-		  || TREE_CODE (TREE_TYPE (lhs)) == VECTOR_TYPE)
-		DECL_GIMPLE_REG_P (temp) = 1;
-	      if (TREE_CODE (orig_lhs) == SSA_NAME)
-		orig_lhs = SSA_NAME_VAR (orig_lhs);
-	      if (TREE_CODE (orig_lhs) == VAR_DECL
-		  && DECL_BASED_ON_RESTRICT_P (orig_lhs))
-		{
-		  DECL_BASED_ON_RESTRICT_P (temp) = 1;
-		  SET_DECL_RESTRICT_BASE (temp,
-					  DECL_GET_RESTRICT_BASE (orig_lhs));
-		}
-
-	      if (gimple_in_ssa_p (cfun))
-		temp = make_ssa_name (temp, NULL);
-	      gimple_set_lhs (stmt, temp);
-	      post_stmt = gimple_build_assign (lhs, temp);
-	      if (TREE_CODE (lhs) == SSA_NAME)
-		SSA_NAME_DEF_STMT (lhs) = post_stmt;
-	    }
-	}
+     create temporary.  */
+      if (lhs && !is_gimple_reg (lhs))
+    {
+      bool need_temp = false;
+
+      if (is_gimple_assign (stmt)
+          && num_ops == 2
+          && get_gimple_rhs_class (gimple_expr_code (stmt))
+         == GIMPLE_SINGLE_RHS)
+        gimplify_expr (gimple_assign_rhs1_ptr (stmt), &pre, NULL,
+               rhs_predicate_for (gimple_assign_lhs (stmt)),
+               fb_rvalue);
+      else if (is_gimple_reg (lhs))
+        {
+          if (is_gimple_reg_type (TREE_TYPE (lhs)))
+        {
+          if (is_gimple_call (stmt))
+            {
+              i = gimple_call_flags (stmt);
+              if ((i & ECF_LOOPING_CONST_OR_PURE)
+              || !(i & (ECF_CONST | ECF_PURE)))
+            need_temp = true;
+            }
+          if (stmt_can_throw_internal (stmt))
+            need_temp = true;
+        }
+        }
+      else
+        {
+          if (is_gimple_reg_type (TREE_TYPE (lhs)))
+        need_temp = true;
+          else if (TYPE_MODE (TREE_TYPE (lhs)) != BLKmode)
+        {
+          if (is_gimple_call (stmt))
+            {
+              tree fndecl = gimple_call_fndecl (stmt);
+
+              if (!aggregate_value_p (TREE_TYPE (lhs), fndecl)
+              && !(fndecl && DECL_RESULT (fndecl)
+                   && DECL_BY_REFERENCE (DECL_RESULT (fndecl))))
+            need_temp = true;
+            }
+          else
+            need_temp = true;
+        }
+        }
+      if (need_temp)
+        {
+          tree temp = create_tmp_var (TREE_TYPE (lhs), NULL);
+
+          if (TREE_CODE (TREE_TYPE (lhs)) == COMPLEX_TYPE
+          || TREE_CODE (TREE_TYPE (lhs)) == VECTOR_TYPE)
+        DECL_GIMPLE_REG_P (temp) = 1;
+          if (TREE_CODE (orig_lhs) == SSA_NAME)
+        orig_lhs = SSA_NAME_VAR (orig_lhs);
+
+          if (gimple_in_ssa_p (cfun))
+        temp = make_ssa_name (temp, NULL);
+          gimple_set_lhs (stmt, temp);
+          post_stmt = gimple_build_assign (lhs, temp);
+          if (TREE_CODE (lhs) == SSA_NAME)
+        SSA_NAME_DEF_STMT (lhs) = post_stmt;
+        }
+    }
       break;
     }
 
@@ -7630,12 +7734,12 @@
   if (!gimple_seq_empty_p (pre))
     {
       if (gimple_in_ssa_p (cfun))
-	{
-	  gimple_stmt_iterator i;
-
-	  for (i = gsi_start (pre); !gsi_end_p (i); gsi_next (&i))
-	    mark_symbols_for_renaming (gsi_stmt (i));
-	}
+    {
+      gimple_stmt_iterator i;
+
+      for (i = gsi_start (pre); !gsi_end_p (i); gsi_next (&i))
+        mark_symbols_for_renaming (gsi_stmt (i));
+    }
       gsi_insert_seq_before (gsi_p, pre, GSI_SAME_STMT);
     }
   if (post_stmt)
@@ -7701,8 +7805,8 @@
 
 tree
 force_gimple_operand_gsi (gimple_stmt_iterator *gsi, tree expr,
-			  bool simple_p, tree var, bool before,
-			  enum gsi_iterator_update m)
+              bool simple_p, tree var, bool before,
+              enum gsi_iterator_update m)
 {
   gimple_seq stmts;
 
@@ -7711,17 +7815,17 @@
   if (!gimple_seq_empty_p (stmts))
     {
       if (gimple_in_ssa_p (cfun))
-	{
-	  gimple_stmt_iterator i;
-
-	  for (i = gsi_start (stmts); !gsi_end_p (i); gsi_next (&i))
-	    mark_symbols_for_renaming (gsi_stmt (i));
-	}
+    {
+      gimple_stmt_iterator i;
+
+      for (i = gsi_start (stmts); !gsi_end_p (i); gsi_next (&i))
+        mark_symbols_for_renaming (gsi_stmt (i));
+    }
 
       if (before)
-	gsi_insert_seq_before (gsi, stmts, m);
+    gsi_insert_seq_before (gsi, stmts, m);
       else
-	gsi_insert_seq_after (gsi, stmts, m);
+    gsi_insert_seq_after (gsi, stmts, m);
     }
 
   return expr;