SIGSEGV in test 316 on SPARCv9

Martin Rehak <[email protected]>
Newsgroups gmane.comp.parsers.bison.bugs
Message-ID <[email protected]>
Hello,

I have another, hopefully the last one:

---<snip>---
mrehak@uls-0:~/workspace/bison/components/bison/build/sparcv9/tests$ ./testsuite -v 316
## --------------------------- ##
## GNU Bison 3.7.3 test suite. ##                                                                                      
## --------------------------- ##
316. actions.at:373: testing Initial location: glr.cc  ...
/builds/mrehak/workspace/bison/components/bison/bison-3.7.3/tests/actions.at:373: COLUMNS=1000; export COLUMNS; NO_TERM
_HYPERLINKS=1; export NO_TERM_HYPERLINKS;  bison --color=no -fno-caret  -o input.cc input.y
/builds/mrehak/workspace/bison/components/bison/bison-3.7.3/tests/actions.at:373: $CXX $CXXFLAGS $CPPFLAGS  $LDFLAGS -o
 input input.cc $LIBS
stderr:          
stdout:                  
/builds/mrehak/workspace/bison/components/bison/bison-3.7.3/tests/actions.at:373:  $PREPARSER ./input
stderr:                   
1.1                                                        
1.1: syntax error    
./testsuite[2584]: .: line 181: 19978: Memory fault(coredump)
/builds/mrehak/workspace/bison/components/bison/bison-3.7.3/tests/actions.at:373: exit code was 267, expected 1
316. actions.at:373:  FAILED (actions.at:373)                                                                          
                                                                                                                       
## ------------- ##                                                                                                    
## Test results. ##                                                                                                    
## ------------- ##                                        
                             
ERROR: 1 test was run,                                     
1 failed unexpectedly.                                                                                                 
...

It is reproducible just on SPARCv9, it passes on SPARCv7.

I have done some debugging on it. These are the arguments of bison and 
g++ commands used:

$ bison --color=no -fno-caret -o input.cc input.y
$ g++ -g -m64 -O3 -mno-app-regs -ffile-prefix-map=/builds/mrehak/workspace/bison/components/bison=. \
  -I/builds/mrehak/workspace/bison/components/bison/bison-3.7.3/tests -D_REENTRANT -o input input.cc \
  /builds/mrehak/workspace/bison/components/bison/build/sparcv9/lib/libbison.a

This is what gdb catches:

Reading symbols from ./input...
(gdb) r
Starting program: /builds/mrehak/workspace/bison/components/bison/build/sparcv9/tests/testsuite.dir/316/input 
[Thread debugging using libthread_db enabled]
1.1
1.1: syntax error
[New Thread 1 (LWP 1)]

Thread 2 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1 (LWP 1)]
0x0000000100003d6c in yydestruct (yyparser=..., yylocationp=0xffffffff7fffeff8, yyvaluep=0xffffffff7fffeff0, 
    yytype=2, yymsg=0x1000025a8 "Cleanup: discarding lookahead") at input.cc:1464
1464      YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
(gdb) bt
#0  0x0000000100003d6c in yydestruct (yyparser=..., yylocationp=0xffffffff7fffeff8, yyvaluep=0xffffffff7fffeff0, 
    yytype=2, yymsg=0x1000025a8 "Cleanup: discarding lookahead") at input.cc:1464
#1  yyparse (yyparser=...) at input.cc:3030
#2  0x0000000100004c7c in yy::parser::parse (this=0xffffffff7ffff170) at input.cc:3209
#3  main () at input.y:43
(gdb) p yyparser
$1 = (yy::parser &) @0xffffffff7ffff170: {_vptr.parser = 0x100002680 <vtable for yy::parser+16>, 
  yycdebug_ = 0x100106398 <std::cerr>}
(gdb) p *yylocationp
$3 = {begin = {filename = 0x0, line = 1, column = 1}, end = {filename = 0x0, line = 1, column = 1}}
(gdb) p *yyvaluep
$4 = 0

And here is how yydestruct looks like in input.cc:

static void                                                                                                            
yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, yy::parser& yyparser)              
{                                                                                                                      
  YYUSE (yyvaluep);                                                                                                    
  YYUSE (yylocationp);                                                                                                 
  YYUSE (yyparser);                                                                                                    
  if (!yymsg)                                                                                                          
    yymsg = "Deleting";                                                                                                
  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);   // <- 1464
                                                                                                                       
  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN                                                                                  
  YYUSE (yytype);                                                                                                      
  YY_IGNORE_MAYBE_UNINITIALIZED_END                                                                                    
}

YYDEBUG is unset. This is the result if I set it:

(gdb) r
Starting program: /builds/mrehak/workspace/bison/components/bison/build/sparcv9/tests/testsuite.dir/316/input 
[Thread debugging using libthread_db enabled]
Starting parse
Entering state 0
Reducing stack 0 by rule 1 (line 22):
1.1
-> $$ = nterm exp (1.1: )
Entering state 1
Reading a token: Next token is token $undefined (1.1: )
1.1: syntax error
Error: popping nterm exp (1.1: )
[New Thread 1 (LWP 1)]

Thread 2 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1 (LWP 1)]
0x0000000100003d6c in yydestruct (yyparser=..., yylocationp=0xffffffff7fffefb8, yyvaluep=0xffffffff7fffefb0, 
    yytype=2, yymsg=0x1000025a8 "Cleanup: discarding lookahead") at input.cc:1464
1464      YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);

Any hint, please?

Thank you
-- 
Martin Rehak
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.