aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorAndreas Arnez <arnez@linux.vnet.ibm.com>2015-11-09 15:35:10 +0000
committerAndreas Krebbel <krebbel@gcc.gnu.org>2015-11-09 15:35:10 +0000
commitfc402eec4b203f2fba90abd57805174d4101d618 (patch)
treea60825da555a0c5971ceed078d9824a9407d97e9 /gcc/c
parentf6b0b3db86a579ae246409aafb1e49005cfebc2c (diff)
downloadgcc-fc402eec4b203f2fba90abd57805174d4101d618.zip
gcc-fc402eec4b203f2fba90abd57805174d4101d618.tar.gz
gcc-fc402eec4b203f2fba90abd57805174d4101d618.tar.bz2
[PR debug/67192] Further fix C loops' back-jump location
gcc/c/ChangeLog: PR debug/67192 * c-typeck.c (c_finish_loop): For unconditional loops, set the location of the backward-goto to the start of the loop body. gcc/testsuite/ChangeLog: PR debug/67192 * gcc.dg/guality/pr67192.c (f3, f4): New functions. (main): Invoke them. From-SVN: r230024
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog6
-rw-r--r--gcc/c/c-typeck.c10
2 files changed, 16 insertions, 0 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 7e22943..a666a3e 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,6 +1,12 @@
2015-11-09 Andreas Arnez <arnez@linux.vnet.ibm.com>
PR debug/67192
+ * c-typeck.c (c_finish_loop): For unconditional loops, set the
+ location of the backward-goto to the start of the loop body.
+
+2015-11-09 Andreas Arnez <arnez@linux.vnet.ibm.com>
+
+ PR debug/67192
* c-parser.c (c_parser_while_statement): Finish the loop before
parsing ahead for misleading indentation.
(c_parser_for_statement): Likewise.
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index 2080db9..9ee2681 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -9898,6 +9898,16 @@ c_finish_loop (location_t start_locus, tree cond, tree incr, tree body,
exit = fold_build3_loc (input_location,
COND_EXPR, void_type_node, cond, exit, t);
}
+ else
+ {
+ /* For the backward-goto's location of an unconditional loop
+ use the beginning of the body, or, if there is none, the
+ top of the loop. */
+ location_t loc = EXPR_LOCATION (expr_first (body));
+ if (loc == UNKNOWN_LOCATION)
+ loc = start_locus;
+ SET_EXPR_LOCATION (exit, loc);
+ }
add_stmt (top);
}