From owner-freebsd-current@FreeBSD.ORG Sun Sep 23 21:50:00 2007 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 65CE916A419 for ; Sun, 23 Sep 2007 21:50:00 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id B222A13C469 for ; Sun, 23 Sep 2007 21:49:59 +0000 (UTC) (envelope-from keramida@ceid.upatras.gr) Received: from kobe.laptop (dialup96.ach.sch.gr [81.186.70.96]) (authenticated bits=128) by igloo.linux.gr (8.14.1/8.14.1/Debian-9) with ESMTP id l8NLnOx5025000 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Mon, 24 Sep 2007 00:49:36 +0300 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.1/8.14.1) with ESMTP id l8NLnMnb011815; Mon, 24 Sep 2007 00:49:23 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Received: (from keramida@localhost) by kobe.laptop (8.14.1/8.14.1/Submit) id l8NLnLY7011806; Mon, 24 Sep 2007 00:49:21 +0300 (EEST) (envelope-from keramida@ceid.upatras.gr) Date: Mon, 24 Sep 2007 00:49:20 +0300 From: Giorgos Keramidas To: Darren Reed Message-ID: <20070923214920.GA11664@kobe.laptop> References: <46F6379B.9050000@freebsd.org> <46F64A4B.8000804@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <46F64A4B.8000804@freebsd.org> X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-3.902, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL 0.50, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@ceid.upatras.gr X-Spam-Status: No Cc: freebsd-current@freebsd.org Subject: Re: yacc bug in reader.c:end_rule() X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Sep 2007 21:50:00 -0000 On 2007-09-23 04:13, Darren Reed wrote: > The following sample grammar will exercise the bug: > > %{ > %} > > %union { > char *ptr; > }; > > %type test > %% > > test: | $$ = malloc(2); > ; > > %% There's definitely a bug somewhere in yacc(1), which this triggers. On 7.0-CURRENT #0: Fri Sep 21 19:09:58 EEST 2007, when I use the following Makefile and this sample grammar, I get: % keramida@kobe:/home/keramida/tmp/yt$ cat -n Makefile % 1 PROG= foo % 2 % 3 SRCS= foo.y % 4 % 5 WARNS?= 6 % 6 WFORMAT?= 2 % 7 % 8 .include % keramida@kobe:/home/keramida/tmp/yt$ make % Warning: Object directory not changed from original /home/keramida/tmp/yt % yacc -d -o foo.c foo.y % *** Signal 11 % % Stop in /home/keramida/tmp/yt. % keramida@kobe:/home/keramida/tmp/yt$ I just happened to be running a userland with DEBUG_FLAGS='-g' and the stack trace of yacc(1) is: % (gdb) where % #0 0x080505ba in end_rule () at /home/build/src/usr.bin/yacc/reader.c:1260 % #1 0x08052920 in read_grammar () at /home/build/src/usr.bin/yacc/reader.c:1621 % #2 0x08053b45 in reader () at /home/build/src/usr.bin/yacc/reader.c:1926 % #3 0x0804b792 in main (argc=Cannot access memory at address 0xc % ) at /home/build/src/usr.bin/yacc/main.c:434 % (gdb) list /home/build/src/usr.bin/yacc/reader.c:1260 % 1255 int i; % 1256 % 1257 if (!last_was_action && plhs[nrules]->tag) % 1258 { % 1259 for (i = nitems - 1; pitem[i]; --i) continue; % 1260 if (pitem[i+1] == 0 || pitem[i+1]->tag != plhs[nrules]->tag) % 1261 default_action_warning(); % 1262 } % 1263 % 1264 last_was_action = 0; % (gdb) If there's anything else I can do to help track this down, please feel free to let me know. - Giorgos