diff options
author | reichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-10-14 21:35:47 +0000 |
---|---|---|
committer | reichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-10-14 21:35:47 +0000 |
commit | 2fa95deeefd95f5c77c0a0ac67a13079f087c37a (patch) | |
tree | 30cd3681486ae4b2227a082c326aee6d97bb53a6 | |
parent | 2d42b7d7e7dc1636970d6443d3a3c7e22159c0e3 (diff) | |
download | gcc-2fa95deeefd95f5c77c0a0ac67a13079f087c37a.tar.gz |
PR c/23439
* c-parser.c (c_parser_for_statement): Use location of RID_FOR
to initialize loc.
* gcc.dg/for-1.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@105422 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/c-parser.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/for-1.c | 7 |
4 files changed, 20 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 28fae441b65..dd60a6eeaeb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2005-10-14 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c/23439 + * c-parser.c (c_parser_for_statement): Use location of RID_FOR + to initialize loc. + 2005-10-14 Per Bothner <per@bothner.com> PR preprocessor/21250 diff --git a/gcc/c-parser.c b/gcc/c-parser.c index ce035694fd2..518a92ce9f5 100644 --- a/gcc/c-parser.c +++ b/gcc/c-parser.c @@ -3776,8 +3776,9 @@ static void c_parser_for_statement (c_parser *parser) { tree block, cond, incr, save_break, save_cont, body; - location_t loc = UNKNOWN_LOCATION; + location_t loc; gcc_assert (c_parser_next_token_is_keyword (parser, RID_FOR)); + loc = c_parser_peek_token (parser)->location; c_parser_consume_token (parser); block = c_begin_compound_stmt (flag_isoc99); if (c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>")) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 877bca8b754..04465c5c902 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-10-14 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c/23439 + * gcc.dg/for-1.c: New test. + 2005-10-14 Mark Mitchell <mark@codesourcery.com> PR c++/19565 diff --git a/gcc/testsuite/gcc.dg/for-1.c b/gcc/testsuite/gcc.dg/for-1.c new file mode 100644 index 00000000000..3df943976fc --- /dev/null +++ b/gcc/testsuite/gcc.dg/for-1.c @@ -0,0 +1,7 @@ +/* PR c/23439 */ +/* Origin: Serge Belyshev <belyshev@depni.sinp.msu.ru> */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +# 0 "for-1.c" +void foo() { for /* { dg-error "at end of input" "" { target *-*-* } 0 } */ |