[PR 95013] EOF location is at end of file
Christophe Lyon
christophe.lyon@linaro.org
Wed May 13 06:44:49 GMT 2020
On Wed, 13 May 2020 at 02:24, H.J. Lu via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> On Tue, May 12, 2020 at 2:24 PM Nathan Sidwell <nathan@acm.org> wrote:
> >
> > My recent C++ parser change to pay attention to EOF location uncovered a
> > separate bug. The preprocesor's EOF logic would set the EOF location to
> > be the beginning of the last line of text in the file -- not the 'line'
> > after that, which contains no characters. Mostly. This fixes things so
> > that when we attempt to read the last line of the main file, we don't
> > pop the buffer until the tokenizer has a chance to create an EOF token
> > with the correct location information. It is then responsible for
> > popping the buffer. As it happens, raw string literal tokenizing
> > contained a bug -- it would increment the line number prematurely,
> > because it cached buffer->cur in a local variable, but checked
> > buffer->cur before updating it to figure out if it was at end of file.
> > We fix up that too.
> >
> > The EOF token intentionally doesn't have a column number -- it's not a
> > position on a line, it's a non-existant line.
> >
> > The testsuite churn is just correcting the EOF location diagnostics.
> > This time I've made sure to check all testsuites, sorry obj-c++ folks.
> >
> > pushed to master.
> >
> > nathan
> >
> > --
> > Nathan Sidwell
>
> I got
>
> ERROR: gcc.dg/unclosed-init.c: syntax error in target selector ".+1"
> for " dg-error 3 "-: expected '.' at end of input" { target *-*-* }
> .+1 "
> ERROR: gcc.dg/unclosed-init.c: syntax error in target selector ".+1"
> for " dg-error 3 "-: expected '.' at end of input" { target *-*-* }
> .+1 "
> ERROR: gcc.dg/unclosed-init.c: syntax error in target selector ".+1"
> for " dg-error 3 "-: expected '.' at end of input" { target *-*-* }
> .+1 "
> ERROR: gcc.dg/unclosed-init.c: syntax error in target selector ".+1"
> for " dg-error 3 "-: expected '.' at end of input" { target *-*-* }
> .+1 "
> ERROR: gcc.dg/unclosed-init.c: syntax error in target selector ".+1"
> for " dg-error 3 "-: expected '.' at end of input" { target *-*-* }
> .+1 "
> ERROR: gcc.dg/unclosed-init.c: syntax error in target selector ".+1"
> for " dg-error 3 "-: expected '.' at end of input" { target *-*-* }
> .+1 "
>
> on Linux/x86:
>
> https://gcc.gnu.org/pipermail/gcc-regression/2020-May/072573.html
>
The updated testcase was missing a comment. I pushed this obvious fix:
commit a7b7818f3dbd14cc7577d25dcebaded07395c476
Author: Christophe Lyon <christophe.lyon@linaro.org>
Date: Wed May 13 06:41:19 2020 +0000
[PR 95013] Fix gcc.dg/unclosed-init.c
2020-05-13 Christophe Lyon <christophe.lyon@linaro.org>
PR preprocessor/95013
* gcc.dg/unclosed-init.c: Add missing comment in dg-error.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5a4215b..03b61dd 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2020-05-13 Christophe Lyon <christophe.lyon@linaro.org>
+
+ PR preprocessor/95013
+ * gcc.dg/unclosed-init.c: Add missing comment in dg-error.
+
2020-05-13 Bin Cheng <bin.cheng@linux.alibaba.com>
PR tree-optimization/94969
diff --git a/gcc/testsuite/gcc.dg/unclosed-init.c
b/gcc/testsuite/gcc.dg/unclosed-init.c
index 16c42c4..0a0ca21 100644
--- a/gcc/testsuite/gcc.dg/unclosed-init.c
+++ b/gcc/testsuite/gcc.dg/unclosed-init.c
@@ -1,3 +1,3 @@
int unclosed[] = { /* { dg-message "18: to match this '.'" } */
42
- /* { dg-error "-: expected '.' at end of input" { target *-*-* } .+1 } */
+ /* { dg-error "-: expected '.' at end of input" "" { target *-*-* } .+1 } */
Thanks,
Christophe
>
> --
> H.J.
More information about the Gcc-patches
mailing list