PR c++/65970 - revert loop location change
authorJason Merrill <jason@redhat.com>
Mon, 25 Jul 2016 21:25:04 +0000 (17:25 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 25 Jul 2016 21:25:04 +0000 (17:25 -0400)
* cp-gimplify.c (genericize_cp_loop): Revert location change.

From-SVN: r238737

gcc/cp/ChangeLog
gcc/cp/cp-gimplify.c

index 87020979510d8b2d816ec8847aab3f7adb029f44..0e3e826d6aceb888896f4f2dbc44b030e80764e7 100644 (file)
@@ -1,5 +1,8 @@
 2016-07-25  Jason Merrill  <jason@redhat.com>
 
+       PR c++/65970
+       * cp-gimplify.c (genericize_cp_loop): Revert location change.
+
        PR c++/71837
        * lambda.c (add_capture): Leave a pack expansion in a TREE_LIST.
        (build_lambda_object): Call build_x_compound_expr_from_list.
index d9f7ceaed5024607652fa0c1897f123c6b8aa1d5..59953a6ee04376969051acb710456be0667f24f4 100644 (file)
@@ -264,7 +264,14 @@ genericize_cp_loop (tree *stmt_p, location_t start_locus, tree cond, tree body,
        loop = stmt_list;
     }
   else
-    loop = build1_loc (start_locus, LOOP_EXPR, void_type_node, stmt_list);
+    {
+      location_t loc = start_locus;
+      if (!cond || integer_nonzerop (cond))
+       loc = EXPR_LOCATION (expr_first (body));
+      if (loc == UNKNOWN_LOCATION)
+       loc = start_locus;
+      loop = build1_loc (loc, LOOP_EXPR, void_type_node, stmt_list);
+    }
 
   stmt_list = NULL;
   append_to_statement_list (loop, &stmt_list);