aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorAndreas Arnez <arnez@linux.vnet.ibm.com>2015-11-09 15:31:32 +0000
committerAndreas Krebbel <krebbel@gcc.gnu.org>2015-11-09 15:31:32 +0000
commitf6b0b3db86a579ae246409aafb1e49005cfebc2c (patch)
tree212fe5f1a13669d66d4d51f3f41b7971c1026e86 /gcc/c
parent0e657ecb98b8413b41975ddfce8e240186720977 (diff)
downloadgcc-f6b0b3db86a579ae246409aafb1e49005cfebc2c.zip
gcc-f6b0b3db86a579ae246409aafb1e49005cfebc2c.tar.gz
gcc-f6b0b3db86a579ae246409aafb1e49005cfebc2c.tar.bz2
[PR debug/67192] Fix C loops' back-jump location
gcc/c/ChangeLog: PR debug/67192 * c-parser.c (c_parser_while_statement): Finish the loop before parsing ahead for misleading indentation. (c_parser_for_statement): Likewise. gcc/testsuite/ChangeLog: PR debug/67192 * gcc.dg/guality/pr67192.c: New test. From-SVN: r230023
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog7
-rw-r--r--gcc/c/c-parser.c13
2 files changed, 14 insertions, 6 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 6fea3a9..7e22943 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,3 +1,10 @@
+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.
+
2015-11-08 Eric Botcazou <ebotcazou@adacore.com>
* c-decl.c (finish_struct): If the structure has reverse storage
diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
index 23d0107..66eb2dd 100644
--- a/gcc/c/c-parser.c
+++ b/gcc/c/c-parser.c
@@ -5437,13 +5437,13 @@ c_parser_while_statement (c_parser *parser, bool ivdep)
= get_token_indent_info (c_parser_peek_token (parser));
body = c_parser_c99_block_statement (parser);
+ c_finish_loop (loc, cond, NULL, body, c_break_label, c_cont_label, true);
+ add_stmt (c_end_compound_stmt (loc, block, flag_isoc99));
token_indent_info next_tinfo
= get_token_indent_info (c_parser_peek_token (parser));
warn_for_misleading_indentation (while_tinfo, body_tinfo, next_tinfo);
- c_finish_loop (loc, cond, NULL, body, c_break_label, c_cont_label, true);
- add_stmt (c_end_compound_stmt (loc, block, flag_isoc99));
c_break_label = save_break;
c_cont_label = save_cont;
}
@@ -5727,15 +5727,16 @@ c_parser_for_statement (c_parser *parser, bool ivdep)
body = c_parser_c99_block_statement (parser);
- token_indent_info next_tinfo
- = get_token_indent_info (c_parser_peek_token (parser));
- warn_for_misleading_indentation (for_tinfo, body_tinfo, next_tinfo);
-
if (is_foreach_statement)
objc_finish_foreach_loop (loc, object_expression, collection_expression, body, c_break_label, c_cont_label);
else
c_finish_loop (loc, cond, incr, body, c_break_label, c_cont_label, true);
add_stmt (c_end_compound_stmt (loc, block, flag_isoc99 || c_dialect_objc ()));
+
+ token_indent_info next_tinfo
+ = get_token_indent_info (c_parser_peek_token (parser));
+ warn_for_misleading_indentation (for_tinfo, body_tinfo, next_tinfo);
+
c_break_label = save_break;
c_cont_label = save_cont;
}