Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Nov 2009 12:46:34 GMT
From:      Philippe Pepiot <ksh@philpep.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/140309: bad syntax cause yacc segfault
Message-ID:  <200911051246.nA5CkYtl093813@www.freebsd.org>
Resent-Message-ID: <200911051250.nA5Co2AQ075219@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         140309
>Category:       bin
>Synopsis:       bad syntax cause yacc segfault
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 05 12:50:02 UTC 2009
>Closed-Date:
>Last-Modified:
>Originator:     Philippe Pepiot
>Release:        9.0 CURRENT
>Organization:
>Environment:
FreeBSD shen.philpep.org 9.0-CURRENT FreeBSD 9.0-CURRENT #0: Wed Nov  4 19:56:02 CET 2009     root@shen.philpep.org:/usr/src/sys/i386/compile/SHEN  i386
>Description:
Sometimes yacc segfault when declare typed rule and you don't set a value to $$ in the grammar rule.

The expected behavior of yacc in this case is to print an error message like
"the value of typed rule hasn't been set".

Here's backtrace :

#0  0x08053811 in end_rule () at /usr/src/usr.bin/yacc/reader.c:1260
1260            if (pitem[i+1] == 0 || pitem[i+1]->tag != plhs[nrules]->tag)


#0  0x08053811 in end_rule () at /usr/src/usr.bin/yacc/reader.c:1260
#1  0x0805486d in read_grammar () at /usr/src/usr.bin/yacc/reader.c:1632
#2  0x08055591 in reader () at /usr/src/usr.bin/yacc/reader.c:1926
#3  0x0804c4b4 in main (argc=2, argv=0xbfbfeb48) at /usr/src/usr.bin/yacc/main.c:434
>How-To-Repeat:
Just yacc this file :

%type <int> rule
%%
rule:
    ;
%%


$ yacc file.y
segmentation fault (core dumped) /usr/bin/yacc
>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200911051246.nA5CkYtl093813>