Csaba Raduly | 5 Feb 17:01
Picon

yyprint does not work with glr-parser

The C code generated from the following grammar will not compile,
because yytoknum is not defined when glr-parser is in use.

%{
// C header part
#include <stdio.h>

static int yylex();

#define YYERROR_VERBOSE

void yyerror(const char *s)
{
puts(s);
}

union YYSTYPE;
static void yyprint(FILE *file, int type, const YYSTYPE& value);
#define YYPRINT(f,t,v) yyprint(f,t,v)

//static int yytoknum[500] = {0};
// Hack to get it  compile
%}

%verbose
%glr-parser

%start GrammarRoot

%token foo
(Continue reading)

Joel E. Denny | 6 Feb 23:05
Favicon

Re: yyprint does not work with glr-parser


On Fri, 5 Feb 2010, Csaba Raduly wrote: > The C code generated from the following grammar will not compile, > because yytoknum is not defined when glr-parser is in use.
You should have better luck with %printer, which is the modern version of YYPRINT. Actually, our %printer documentation is poor. It has the same syntax as %destructor. You print to yyoutput, which is a FILE*. For example: %printer { fprintf (yyoutput, "%d", $$); } BOOL <integer> It's not clear to me whether we should add YYPRINT support to GLR or if we should just document the lack of support.
Csaba Raduly | 8 Feb 19:37
Picon

Re: yyprint does not work with glr-parser

On Sat, Feb 6, 2010 at 11:05 PM, Joel E. Denny <jdenny <at> clemson.edu> wrote:
> On Fri, 5 Feb 2010, Csaba Raduly wrote:
>
>> The C code generated from the following grammar will not compile,
>> because yytoknum is not defined when glr-parser is in use.
>
> You should have better luck with %printer, which is the modern version of
> YYPRINT.  Actually, our %printer documentation is poor.

Make that non-existent, bar some examples :)

> It has the same
> syntax as %destructor.  You print to yyoutput, which is a FILE*.  For
> example:
>
>  %printer { fprintf (yyoutput, "%d", $$); } BOOL <integer>
>
> It's not clear to me whether we should add YYPRINT support to GLR or if we
> should just document the lack of support.
>

At least it (seems to) work with 2.3 too so I don't have to hack yyprint.
Pity that only 2.4 seems to accept the "<integer>" form.

--

-- 
Life is complex, with real and imaginary parts

Joel E. Denny | 8 Feb 19:59
Favicon

Re: yyprint does not work with glr-parser


On Mon, 8 Feb 2010, Csaba Raduly wrote: > >  %printer { fprintf (yyoutput, "%d", $$); } BOOL <integer> > Pity that only 2.4 seems to accept the "<integer>" form.
Right, that was added in 2.3a.
Albert Chin | 1 Feb 21:06

Test 52 failure on AIX, HP-UX, Solaris

Test 52 fails on AIX, HP-UX, and Solaris:
52. output.at:159: testing ...
./output.at:159: VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no";
export VALGRIND_OPTS; bison -o foo.y foo.y
2c2,3
< 
---
> /opt/TWWfsw/m414/bin/gm4:/opt/build/bison-2.4.1a/data/yacc.c:694: ERROR: copying inserted
file: Broken pipe
> /opt/TWWfsw/m414/bin/gm4: write error
52. output.at:159: 52. Conflicting output files:  -o foo.y (output.at:159): FAILED (output.at:159)

We're seeing the same failure on AIX and HP-UX.

--

-- 
albert chin (china <at> thewrittenword.com)

Joel E. Denny | 2 Feb 00:56
Favicon

Re: Test 52 failure on AIX, HP-UX, Solaris

On Mon, 1 Feb 2010, Albert Chin wrote:

> Test 52 fails on AIX, HP-UX, and Solaris:
> 52. output.at:159: testing ...
> ./output.at:159: VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no";
export VALGRIND_OPTS; bison -o foo.y foo.y
> 2c2,3
> < 
> ---
> > /opt/TWWfsw/m414/bin/gm4:/opt/build/bison-2.4.1a/data/yacc.c:694: ERROR: copying inserted
file: Broken pipe
> > /opt/TWWfsw/m414/bin/gm4: write error
> 52. output.at:159: 52. Conflicting output files:  -o foo.y (output.at:159): FAILED (output.at:159)
> 
> We're seeing the same failure on AIX and HP-UX.

I'm pretty sure this means your m4 is broken.  Please confirm that you're 
running at least GNU M4 1.4.6.

Albert Chin | 2 Feb 06:27

Re: Test 52 failure on AIX, HP-UX, Solaris

On Mon, Feb 01, 2010 at 06:56:03PM -0500, Joel E. Denny wrote:
> On Mon, 1 Feb 2010, Albert Chin wrote:
> 
> > Test 52 fails on AIX, HP-UX, and Solaris:
> > 52. output.at:159: testing ...
> > ./output.at:159: VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no";
export VALGRIND_OPTS; bison -o foo.y foo.y
> > 2c2,3
> > < 
> > ---
> > > /opt/TWWfsw/m414/bin/gm4:/opt/build/bison-2.4.1a/data/yacc.c:694: ERROR: copying inserted
file: Broken pipe
> > > /opt/TWWfsw/m414/bin/gm4: write error
> > 52. output.at:159: 52. Conflicting output files:  -o foo.y (output.at:159): FAILED (output.at:159)
> > 
> > We're seeing the same failure on AIX and HP-UX.
> 
> I'm pretty sure this means your m4 is broken.  Please confirm that you're 
> running at least GNU M4 1.4.6.

We're running 1.4.12.

--

-- 
albert chin (china <at> thewrittenword.com)

Joel E. Denny | 2 Feb 06:42
Favicon

Re: Test 52 failure on AIX, HP-UX, Solaris

On Mon, 1 Feb 2010, Albert Chin wrote:

> On Mon, Feb 01, 2010 at 06:56:03PM -0500, Joel E. Denny wrote:
> > On Mon, 1 Feb 2010, Albert Chin wrote:
> > 
> > > Test 52 fails on AIX, HP-UX, and Solaris:
> > > 52. output.at:159: testing ...
> > > ./output.at:159: VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no";
export VALGRIND_OPTS; bison -o foo.y foo.y
> > > 2c2,3
> > > < 
> > > ---
> > > > /opt/TWWfsw/m414/bin/gm4:/opt/build/bison-2.4.1a/data/yacc.c:694: ERROR: copying inserted
file: Broken pipe
> > > > /opt/TWWfsw/m414/bin/gm4: write error
> > > 52. output.at:159: 52. Conflicting output files:  -o foo.y (output.at:159): FAILED (output.at:159)
> > > 
> > > We're seeing the same failure on AIX and HP-UX.
> > 
> > I'm pretty sure this means your m4 is broken.  Please confirm that you're 
> > running at least GNU M4 1.4.6.
> 
> We're running 1.4.12.

You're saying that /opt/TWWfsw/m414/bin/gm4, which is mentioned in the 
error message, is GNU M4 1.4.12?

I should point out that M4 in your environment would cause Bison to use a 
different m4 than the one discovered by configure.

Do any other test cases fail?  Attaching a complete tests/testsuite.log 
and config.log might help us debug this.

(Continue reading)

Joel E. Denny | 2 Feb 07:19
Favicon

Re: Test 52 failure on AIX, HP-UX, Solaris

On Tue, 2 Feb 2010, Joel E. Denny wrote:

> On Mon, 1 Feb 2010, Albert Chin wrote:
> 
> > On Mon, Feb 01, 2010 at 06:56:03PM -0500, Joel E. Denny wrote:
> > > On Mon, 1 Feb 2010, Albert Chin wrote:
> > > 
> > > > Test 52 fails on AIX, HP-UX, and Solaris:
> > > > 52. output.at:159: testing ...
> > > > ./output.at:159: VALGRIND_OPTS="$VALGRIND_OPTS --leak-check=summary --show-reachable=no";
export VALGRIND_OPTS; bison -o foo.y foo.y
> > > > 2c2,3
> > > > < 
> > > > ---
> > > > > /opt/TWWfsw/m414/bin/gm4:/opt/build/bison-2.4.1a/data/yacc.c:694: ERROR: copying
inserted file: Broken pipe
> > > > > /opt/TWWfsw/m414/bin/gm4: write error
> > > > 52. output.at:159: 52. Conflicting output files:  -o foo.y (output.at:159): FAILED (output.at:159)
> > > > 
> > > > We're seeing the same failure on AIX and HP-UX.
> > > 
> > > I'm pretty sure this means your m4 is broken.  Please confirm that you're 
> > > running at least GNU M4 1.4.6.
> > 
> > We're running 1.4.12.
> 
> You're saying that /opt/TWWfsw/m414/bin/gm4, which is mentioned in the 
> error message, is GNU M4 1.4.12?
> 
> I should point out that M4 in your environment would cause Bison to use a 
> different m4 than the one discovered by configure.

Never mind.  I think I see the problem now.  This test group produces a 
fatal error, which invokes exit, while the m4 subpipe is still open.  
Apparently that causes ugly error messages on some platforms.

We should probably change bison not to do this... and there are many other 
places where fatal errors might occur while the m4 subpipe is open.  For 
release 2.4.2, it might be better just to detect the problem and skip the 
associated test groups.  I'll have to give it more thought.

> Do any other test cases fail?  Attaching a complete tests/testsuite.log 
> and config.log might help us debug this.

That would still be helpful.

While the following patch is obviously not a good solution, would you 
please confirm that it does allow the test group to pass on the affected 
platforms?

diff --git a/src/files.c b/src/files.c
index 9761de9..63c9e2a 100644
--- a/src/files.c
+++ b/src/files.c
@@ -350,11 +350,15 @@ compute_output_file_names (void)
   free (header_extension);
 }

-void
+bool
(Continue reading)

Albert Chin | 2 Feb 07:37

Re: Test 52 failure on AIX, HP-UX, Solaris


On Tue, Feb 02, 2010 at 01:19:38AM -0500, Joel E. Denny wrote: > While the following patch is obviously not a good solution, would you > please confirm that it does allow the test group to pass on the > affected platforms?
Confirmed on RHEL4/x86-64. -- -- albert chin (china <at> thewrittenword.com)
Joel E. Denny | 2 Feb 10:30
Favicon

Re: Test 52 failure on AIX, HP-UX, Solaris

On Tue, 2 Feb 2010, Albert Chin wrote:

> On Tue, Feb 02, 2010 at 01:19:38AM -0500, Joel E. Denny wrote:
> > While the following patch is obviously not a good solution, would you
> > please confirm that it does allow the test group to pass on the
> > affected platforms?
> 
> Confirmed on RHEL4/x86-64.

Thanks.

Here's an attempt at fixing this.  Not yet pushed.  I now need to decide 
whether this fix is too much for 2.4.2.  If so, I suppose I could just 
comment out the affected test group for 2.4.2, but I'm suspicious that 
there's a race condition that could sometimes affect other test groups.  
I'd appreciate comments from anyone.

>From 09f99a629f7aa0d696646d28d23cde47588f4e38 Mon Sep 17 00:00:00 2001
From: Joel E. Denny <jdenny <at> clemson.edu>
Date: Tue, 2 Feb 2010 04:10:30 -0500
Subject: [PATCH] portability: don't exit before reaping m4 child.

This was happening at fatal errors during scan_skel.  Broken
pipe messages were seen on at least AIX, HP-UX, Solaris, and
RHEL4, and this caused failures in the test suite.  Is this more
a race condition than a portability issue?
Reported by Albert Chin at
<http://lists.gnu.org/archive/html/bug-bison/2010-02/msg00004.html>.
* NEWS (2.4.2): Document.
* lib/subpipe.c, lib/subpipe.h (reap_subpipe): Add
ignore_failure argument to avoid a redundant error message after
already reporting a fatal error.
* src/complain.c, src/complain.h (fatal_at_delayed,
fatal_delayed): New functions.
* src/files.c (compute_output_file_names): Update invocations
of output_file_name_check.
(output_file_name_check): In the case that the grammar file
would be overwritten, use complain instead of fatal, but replace
(Continue reading)


Gmane