From 1509db23604690d10ad242e764933a13e99c9c28 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 25 Jul 2016 17:25:04 -0400 Subject: [PATCH] PR c++/65970 - revert loop location change * cp-gimplify.c (genericize_cp_loop): Revert location change. From-SVN: r238737 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/cp-gimplify.c | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 87020979510..0e3e826d6ac 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2016-07-25 Jason Merrill + 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. diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index d9f7ceaed50..59953a6ee04 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -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); -- 2.30.2