OSDN Git Service

* flow.c (recompute_reg_usage): Make it static.
[pf3gnuchains/gcc-fork.git] / gcc / cp / cp-gimplify.c
index 4ad30b9..a9fb7bf 100644 (file)
@@ -17,8 +17,8 @@ for more details.
 
 You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING.  If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.  */
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.  */
 
 #include "config.h"
 #include "system.h"
@@ -247,8 +247,7 @@ gimplify_cp_loop (tree cond, tree body, tree incr, bool cond_is_first)
       if (cond && !integer_nonzerop (cond))
        {
          t = build_bc_goto (bc_break);
-         exit = build3 (COND_EXPR, void_type_node, cond, exit, t);
-         exit = fold (exit);
+         exit = fold_build3 (COND_EXPR, void_type_node, cond, exit, t);
          gimplify_stmt (&exit);
 
          if (cond_is_first)
@@ -362,7 +361,7 @@ gimplify_expr_stmt (tree *stmt_p)
          if (!IS_EMPTY_STMT (stmt)
              && !VOID_TYPE_P (TREE_TYPE (stmt))
              && !TREE_NO_WARNING (stmt))
-           warning (0, "statement with no effect");
+           warning (OPT_Wextra, "statement with no effect");
        }
       else if (warn_unused_value)
        warn_if_unused_value (stmt, input_location);
@@ -409,7 +408,7 @@ cp_gimplify_init_expr (tree *expr_p, tree *pre_p, tree *post_p)
       *expr_p = from;
 
       /* The initialization is now a side-effect, so the container can
-         become void.  */
+        become void.  */
       if (from != sub)
        TREE_TYPE (from) = void_type_node;
     }
@@ -478,15 +477,17 @@ cp_gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p)
       ret = GS_OK;
       break;
 
+      /* We used to do this for MODIFY_EXPR as well, but that's unsafe; the
+        LHS of an assignment might also be involved in the RHS, as in bug
+        25979.  */
     case INIT_EXPR:
-    case MODIFY_EXPR:
       cp_gimplify_init_expr (expr_p, pre_p, post_p);
       ret = GS_OK;
       break;
 
     case EMPTY_CLASS_EXPR:
-      /* We create an INTEGER_CST with RECORD_TYPE and value zero.  */
-      *expr_p = build_int_cst (TREE_TYPE (*expr_p), 0);
+      /* We create an empty CONSTRUCTOR with RECORD_TYPE.  */
+      *expr_p = build_constructor (TREE_TYPE (*expr_p), NULL);
       ret = GS_OK;
       break;
 
@@ -596,7 +597,10 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
   tree stmt = *stmt_p;
   struct pointer_set_t *p_set = (struct pointer_set_t*) data;
 
-  if (is_invisiref_parm (stmt))
+  if (is_invisiref_parm (stmt)
+      /* Don't dereference parms in a thunk, pass the references through. */
+      && !(DECL_THUNK_P (current_function_decl)
+           && TREE_CODE (stmt) == PARM_DECL))
     {
       *stmt_p = convert_from_reference (stmt);
       *walk_subtrees = 0;
@@ -635,7 +639,7 @@ cp_genericize_r (tree *stmt_p, int *walk_subtrees, void *data)
                      CLEANUP_EXPR (stmt));
 
   pointer_set_insert (p_set, *stmt_p);
-  
+
   return NULL;
 }