Bug 106014 - sys-devel/bison-1.875d outputs garbage when invalid %parse-param directive is used
|
Bug#:
106014
|
Product: Gentoo Linux
|
Version: unspecified
|
Platform: AMD64
|
|
OS/Version: Linux
|
Status: RESOLVED
|
Severity: trivial
|
Priority: P2
|
|
Resolution: FIXED
|
Assigned To: base-system@gentoo.org
|
Reported By: brodigan@pdx.edu
|
|
Component: Applications
|
|
|
URL:
http://lists.gnu.org/archive/html/bug-bison/2005-07/msg00053.html
|
|
Summary: sys-devel/bison-1.875d outputs garbage when invalid %parse-param directive is used
|
|
Keywords:
|
|
Status Whiteboard:
|
|
Opened: 2005-09-14 15:46 0000
|
When constructing a bison syntax file and using the %parse-param directive
without the { } to contain the actual C param to be passed, bison outputs a
garbage error message.
/usr/bin/bison -v -d -p test_parser_ -b test_parser test_parser.y
test_parser.y:13.17: missing `{' in `H
When constructing a bison syntax file and using the %parse-param directive
without the { } to contain the actual C param to be passed, bison outputs a
garbage error message.
/usr/bin/bison -v -d -p test_parser_ -b test_parser test_parser.y
test_parser.y:13.17: missing `{' in `H ÞÿÿHH$HHDHBHD$HBHD$H'
Reproducible: Always
Steps to Reproduce:
1. Create skeleton bison syntax file with the malformed %parse-param directive
2. /usr/bin/bison -v -d -p test_parser_ -b test_parser test_parser.y
3.
Actual Results:
test_parser.y:10.14: missing `{' in `H ÞÿÿHH$HHDHBHD$HBHD$H'
Expected Results:
a decent error
Gentoo Base System version 1.6.13
Portage 2.0.51.22-r2 (default-linux/amd64/2005.0, gcc-3.4.4, glibc-2.3.5-r1,
2.6.12-gentoo-r6 x86_64)
=================================================================
System uname: 2.6.12-gentoo-r6 x86_64 AMD Athlon(tm) 64 Processor 3400+
dev-lang/python: 2.3.5-r2
sys-apps/sandbox: 1.2.12
sys-devel/autoconf: 2.13, 2.59-r6
sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6
sys-devel/binutils: 2.15.92.0.2-r10
sys-devel/libtool: 1.5.18-r1
virtual/os-headers: 2.6.11-r2
ACCEPT_KEYWORDS="amd64"
AUTOCLEAN="yes"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-pipe -O3 -march=k8"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/lib/X11/xkb /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-pipe -O3 -march=k8"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://distfiles.gentoo.org
http://distro.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="amd64 X aac alsa avi berkdb bitmap-fonts cdr crypt curl dvd dvdread eds
emboss encode esd fam flac foomaticdb fortran gif gnome gpm gstreamer gtk gtk2
imlib ipv6 jpeg libvisual lzw lzw-tiff mp3 mpeg ncurses network nls ogg
oggvorbis opengl pam pdflib perl png python quicktime readline samba sdl softmmu
speex spell sqlite ssl tcpd theora tiff truetype-fonts type1-fonts usb
userlocales vorbis xine xml2 xpm xv zlib userland_GNU kernel_linux elibc_glibc"
Unset: ASFLAGS, CTARGET, LANG, LC_ALL, LDFLAGS, LINGUAS
does it work with bison-2 ?
sys-devel/bison-2.0 segfaults, here's the backtrace of "/usr/bin/bison -v -d -p
test_parser_ -b test_parser test_parser.y".
#0 0x00002aaaaac2ffb0 in strlen () from /lib/libc.so.6
#1 0x00002aaaaac059fc in vfprintf () from /lib/libc.so.6
#2 0x00002aaaaac02434 in cuserid () from /lib/libc.so.6
#3 0x00002aaaaac027fa in vfprintf () from /lib/libc.so.6
#4 0x0000000000402f55 in complain_at (loc=
{start = {file = 0x540610 "metadata_parser.y", line = 19, column = 17},
end = {file = 0x540610 "metadata_parser.y", line = 19, column = 18}},
message=0x435427 "missing `{' in `%s'") at complain.c:89
#5 0x0000000000419f37 in gram_lex (val=0x7fffffe2f798, loc=0x7fffffe32930)
at scan-gram.l:537
#6 0x000000000040fbed in gram_parse () at parse-gram.c:1259
#7 0x0000000000413e31 in reader () at reader.c:483
#8 0x0000000000406fbd in main (argc=8, argv=0x7fffffe32a68) at main.c:80
why dont you post the source .y file as an attachment so we can try to
reproduce
The attached file is a test example of bison using the %parse-param directive.
The test file is a simple postfix calculator which calculates postfix algebra
and accumulates results into the int *i variable passed by %parse-param. To
compile, test and run the attached file simpley run the following commands.
bison -v -d -b test test.y
gcc -Wall test.tab.c -o test
./test
Then enter various postfix algebraic equations using integers and the operators
+, -, *, / and the unary - (which takes the form "NUM n" in this implementation).
This postfix calculator example was inspired by (ripped off from)
http://dinosaur.compilertools.net/bison/bison_5.html,
the good news is that bison-2.0 flags it as invalid ... the bad news is that
the
error message which tells you that your code is wrong segfaults (as you show in
gdb) :)
ok, it was reported about two months ago upstream and fixed ... ive grabbed the
diff from cvs and added to our current 2.0 ebuild