]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/tree-nested.c
tree-nested.c (finalize_nesting_tree_1): Disable warn_padded around layout_type call.
[thirdparty/gcc.git] / gcc / tree-nested.c
index 124bbf98cfb2ce78e446e5fc2b1596f31f050680..1721bca9745446c920c4e437781bb38e58efd7a3 100644 (file)
@@ -871,9 +871,14 @@ convert_nonlocal_reference (tree *tp, int *walk_subtrees, void *data)
 
        if (wi->changed)
          {
+           tree save_context;
+
            /* If we changed anything, then TREE_INVARIANT is be wrong,
               since we're no longer directly referencing a decl.  */
+           save_context = current_function_decl;
+           current_function_decl = info->context;
            recompute_tree_invarant_for_addr_expr (t);
+           current_function_decl = save_context;
 
            /* If the callback converted the address argument in a context
               where we only accept variables (and min_invariant, presumably),
@@ -996,10 +1001,15 @@ convert_local_reference (tree *tp, int *walk_subtrees, void *data)
        /* If we converted anything ... */
        if (wi->changed)
          {
+           tree save_context;
+
            /* Then the frame decl is now addressable.  */
            TREE_ADDRESSABLE (info->frame_decl) = 1;
            
+           save_context = current_function_decl;
+           current_function_decl = info->context;
            recompute_tree_invarant_for_addr_expr (t);
+           current_function_decl = save_context;
 
            /* If we are in a context where we only accept values, then
               compute the address into a temporary.  */
@@ -1317,7 +1327,12 @@ finalize_nesting_tree_1 (struct nesting_info *root)
      out at this time.  */
   if (root->frame_type)
     {
+      /* In some cases the frame type will trigger the -Wpadded warning.
+        This is not helpful; suppress it. */
+      int save_warn_padded = warn_padded;
+      warn_padded = 0;
       layout_type (root->frame_type);
+      warn_padded = save_warn_padded;
       layout_decl (root->frame_decl, 0);
     }