Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[perl #42336] segfault happens with 'parrot --pre-process-only'

3 views
Skip to first unread message

Jim McKim

unread,
Apr 7, 2007, 8:59:59 PM4/7/07
to bugs-bi...@rt.perl.org
# New Ticket Created by "Jim McKim"
# Please include the string: [perl #42336]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=42336 >


---
osname= linux
osvers= 2.6.15-gentoo-alt2
arch= x86_64-linux
cc= x86_64-pc-linux-gnu-gcc
---
Flags:
category=core
severity=low
ack=no
---
The sample parrot code below causes parrot to segfault when parrot is
invoked with '-E' or '--pre-process-only':


.sub 'main' :main
printerr "hello\n"
.end


gdb says:

(gdb) r -E t.pir
Starting program: /usr/local/bin/parrot -E t.pir
[Thread debugging using libthread_db enabled]
[New Thread 46912533172160 (LWP 13149)]
[New Thread 1082132816 (LWP 13152)]
[New Thread 1090525520 (LWP 13153)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 46912533172160 (LWP 13149)]
0x00002aaaaaec2dea in yylex (valp=0x7fffffc82060, yyscanner=0x50c010,
interp=0x80c200) at imcc.l:121
121 if (IMCC_INFO(interp)->expect_pasm == 1 &&
!IMCC_INFO(interp)->in_pod
) {
(gdb) where
#0 0x00002aaaaaec2dea in yylex (valp=0x7fffffc82060, yyscanner=0x50c010,
interp=0x80c200) at imcc.l:121
#1 0x00000000004024c3 in do_pre_process (interp=0x50c010) at main.c:405
#2 0x0000000000402e3f in main (argc=1, argv=0x7fffffc82208) at main.c:571
(gdb) f 2
#2 0x0000000000402e3f in main (argc=1, argv=0x7fffffc82208) at main.c:571
571 do_pre_process(interp);
(gdb) p interp
$1 = (Interp *) 0x50c010
(gdb) f 1
#1 0x00000000004024c3 in do_pre_process (interp=0x50c010) at main.c:405
405 while ( (c = yylex(&val, interp, yyscanner)) ) {
(gdb) p interp
$3 = (Parrot_Interp) 0x50c010


********* note here (below), the address of 'interp' has changed in
frame 0 (yylex). Further, the first word of 'interp' has the former
address, and the rest is uninitialized, as if a deref'd variable were
being assigned an address. I tried prefixing interp (&interp) in the
call to yylex (in do_pre_process) to no effect. I'm not yet that
familiar with the code, perhaps I'm looking in the wrong place.

(gdb) f 0
#0 0x00002aaaaaec2dea in yylex (valp=0x7fffffc82060, yyscanner=0x50c010,
interp=0x80c200) at imcc.l:121
121 if (IMCC_INFO(interp)->expect_pasm == 1 &&
!IMCC_INFO(interp)->in_pod
) {
(gdb) p interp
$4 = (Interp *) 0x80c200
(gdb) p *interp
$5 = {ctx = {state = 0x50c010, bp = {regs_n = 0x0, regs_i = 0x0}, bp_ps = {
regs_p = 0x0, regs_s = 0x0}}, ctx_mem = {free_list = 0x0, n_free_slots
= 0},
arena_base = 0x0, class_hash = 0x0, vtables = 0x0, n_vtable_max = 0,
n_vtable_alloced = 0, piodata = 0x0, op_lib = 0x0, op_count = 0,
op_info_table = 0x0, op_func_table = 0x0, evc_func_table = 0x0,
save_func_table = 0x0, n_libs = 0, all_op_libs = 0x0, flags =
PARROT_NO_FLAGS,
debug_flags = 225, run_core = PARROT_SLOW_CORE, profile = 0x50c010,
resume_flag = 0, resume_offset = 0, code = 0x1, initial_pf = 0x0,
imc_info = 0x0, output_file = 0x0, pdb = 0x0, debugger = 0x0, dynamic_env
= 0x0,
lo_var_ptr = 0x0, parent_interpreter = 0x0, world_inited = 0, iglobals =
0x0,
DOD_registry = 0x0, HLL_info = 0x0, HLL_namespace = 0x0, root_namespace =
0x0,
binop_mmd_funcs = 0x0, n_binop_mmd_funcs = 0, caches = 0x0,
const_cstring_table = 0x0, task_queue = 0x0, exit_handler_list = 0x0,
sleeping = 1, exceptions = 0x0, exc_free_list = 0x14c91, exception_list =
0x0,
current_runloop_level = 0, current_runloop_id = 0, thread_data = 0x0,
recursion_limit = 0, gc_generation = 0, current_args = 0x0,
current_params = 0x0, current_returns = 0x0, current_cont = 0x0,
current_object = 0x0, current_method = 0x0}

Looking through the bug list, I noticed another report of a similar
problem (ID 36852), along with a patch. I checked, the patch appears
in my current version of parrot.

--

Jim McKim

---
Summary of my parrot 0.4.10 (r0) configuration:
configdate='Wed Apr 4 19:44:29 2007'
Platform:
osname=linux, archname=x86_64-linux
jitcapable=0, jitarchname=nojit,
jitosname=linux, jitcpuarch=x86_64
execcapable=0
perl=/usr/bin/perl5.8.8
Compiler:
cc='x86_64-pc-linux-gnu-gcc', ccflags=' -pipe
-Wdeclaration-after-statement -D_LA
RGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -fPIC -I /usr/include',
Linker and Libraries:
ld='x86_64-pc-linux-gnu-gcc', ldflags=' -L/usr/local/lib64',
cc_ldflags='',
libs='-lpthread -lnsl -ldl -lm -lcrypt -lutil -lrt -lgmp -lreadline
-lncurses'
Dynamic Linking:
share_ext='.so', ld_share_flags='-shared -L/usr/local/lib64 -fPIC',
load_ext='.so', ld_load_flags='-shared -L/usr/local/lib64 -fPIC'
Types:
iv=long, intvalsize=8, intsize=4, opcode_t=long, opcode_t_size=8,
ptrsize=8, ptr_alignment=1 byteorder=12345678,
nv=double, numvalsize=8, doublesize=8

---
Environment:
HOME =/home/mckim
LANG (unset)
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH
=/usr/kde/3.5/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux
-gnu/gcc-bin/3.4.5:/opt/blackdown-jdk-1.4.2.03/bin:/opt/blackdown-
jdk-1.4.2.03/jre/bi
n:/usr/bin:/usr/kde/3.5/bin:/usr/qt/3/bin:/usr/kde/3.4/bin:/usr/games/bin:/opt/vmware
/workstation/bin
SHELL =/bin/bash

0 new messages