genbc from head segfault on FreeBSD 8.0-STABLE AMD64

Project:GNU Smalltalk
Component:Build
Category:bug
Priority:normal
Assigned:Unassigned
Status:fixed
Description

Git version doesn't compile on FreeBSD: genbc segfault.
GNU Smalltalk 3.1 works well (from freebsd ports).

Attached is the log from make + gdb backtrace.

(attach function doesn't work here) :
gmake[1]: Entering directory `/usr/home/def/Sandbox/visualgst/smalltalk/libgst'
gmake[1]: `genbc' is up to date.
gmake[1]: Leaving directory `/usr/home/def/Sandbox/visualgst/smalltalk/libgst'
./genbc ./byte.def ./byte.c ./opt.c ./xlat.c > match.h
gmake: *** [match.stamp] Segmentation fault: 11 (core dumped)gdb --args ./genbc ./byte.def ./byte.c ./opt.c ./xlat.c
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
(gdb) run
Starting program: /usr/home/def/Sandbox/visualgst/smalltalk/libgst/genbc ./byte.def ./byte.c ./opt.c ./xlat.c

Program received signal SIGSEGV, Segmentation fault.
0x0000000000402471 in decl_yyparse () at genbc-decl.y:169
169 *($1->pnext) = f;
(gdb) bt

  1. 0 0x0000000000402471 in decl_yyparse () at genbc-decl.y:169
  2. 1 0x0000000000404105 in parse_declarations (file=Variable "file" is not available.

) at genbc-scan.l:387

  1. 2 0x00000000004058bc in main (argc=5, argv=0x7fffffffe6d8) at genbc.c:105

(gdb)

Updates

#1 submitted by Defre on Sun, 01/10/2010 - 15:35
Status:active» patch
Attachment:patch-genbc-decl.y.patch (681 bytes)

genbc does a wrong allocation with malloc in genbc-decl.y:162 (should allocate enough bytes for the whole struct, not for a pointer).

#2 submitted by Paolo Bonzini on Mon, 01/11/2010 - 08:36
Status:patch» fixed

Committed, thanks!

User login