aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorAndreas Arnez <arnez@linux.vnet.ibm.com>2015-12-02 07:26:30 +0000
committerAndreas Krebbel <krebbel@gcc.gnu.org>2015-12-02 07:26:30 +0000
commitfe78aa0474d9469384951dbddcd5aeea5f40c03c (patch)
tree22b8c4643f1392c93c1f11bdb98955d9afa2a630 /gcc/cp
parentdf096e508e95abecfacdf0c18abae8807b56cc11 (diff)
downloadgcc-fe78aa0474d9469384951dbddcd5aeea5f40c03c.zip
gcc-fe78aa0474d9469384951dbddcd5aeea5f40c03c.tar.gz
gcc-fe78aa0474d9469384951dbddcd5aeea5f40c03c.tar.bz2
[PR68603] Associate conditional C++ loop's back-jump with start, not body
SVN commit r230979 always associates a loop's back-jump with the start of the loop body. This caused a regression for gcov with conditional loops, because then the loop body appears to be covered twice per iteration. 2015-12-02 Andreas Arnez <arnez@linux.vnet.ibm.com> PR gcov-profile/68603 * cp-gimplify.c (genericize_cp_loop): For the back-jump's location use the start of the loop body only if the loop is unconditional. From-SVN: r231146
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog11
-rw-r--r--gcc/cp/cp-gimplify.c4
2 files changed, 14 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9cc0a53..385ba63 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,14 @@
+2015-12-02 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ PR gcov-profile/68603
+ * cp-gimplify.c (genericize_cp_loop): For the back-jump's location
+ use the start of the loop body only if the loop is unconditional.
+
+2015-11-26 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ * cp-gimplify.c (genericize_cp_loop): Change LOOP_EXPR's location
+ to start of loop body instead of start of loop.
+
2015-12-01 Julian Brown <julian@codesourcery.com>
Cesar Philippidis <cesar@codesourcery.com>
James Norris <James_Norris@mentor.com>
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c
index a9a34cd..3c89f1b 100644
--- a/gcc/cp/cp-gimplify.c
+++ b/gcc/cp/cp-gimplify.c
@@ -264,7 +264,9 @@ genericize_cp_loop (tree *stmt_p, location_t start_locus, tree cond, tree body,
}
else
{
- location_t loc = EXPR_LOCATION (expr_first (body));
+ 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);