Subject: bug#11083: guile-2.0.5 bug report

From: Kiyoshi KANAZAWA <[email-masked]>
Date: Wed, 11 Apr 2012 17:32:51 +0900 (JST)

Hi, Mark,

I was reconstructing GNU software building environment.
I put 32 bit code in /usr/local/GNU and 64bit ones in /usr/local/GNU/amd64.
I sometimes had to specify "-I/usr/local/GNU/amd64/include -L/usr/local/GNU/amd64/lib",
but it was harmful.
Now I do not have to use them in almost softwares.

As the result of this, backtrace of guile has got easy to understand.
"Segmentation Fault" happens in line 895 of vm-i-system.c,
  ret = subr (sp[-1], sp[0]);

Whole the backtrace is:
  [1] __lwp_kill(0x1, 0x6, 0xffffffff89b048a0, 0x7fffffc5338e, 0x6f00312e6f732e63, 0x612f6e00312e), at 0x7fffffc52a9a 
  [2] _thr_kill(0x0, 0x0, 0x0, 0x0, 0x0, 0x0), at 0x7fffffc4b393 
  [3] raise(0x0, 0x0, 0x0, 0x0, 0x0, 0x0), at 0x7fffffbf7d59 
  [4] abort(0x0, 0x0, 0x0, 0x0, 0x0, 0x0), at 0x7fffffbd68c0 
=>[5] pre_init_throw(k = 0x45b4c0, args = 0x4e2220), line 526 in "throw.c"
  [6] vm_regular_engine(vm = 0x4db270, program = 0x4d6320, argv = 0x1, nargs = 2), line 895 in "vm-i-system.c"
  [7] scm_c_vm_run(vm = 0x4db270, program = 0x4d6320, argv = 0xfffffd7fffdfe130, nargs = 6), line 567 in "vm.c"
  [8] scm_call_with_vm(vm = 0x4db270, proc = 0x4d6320, args = 0x4db270), line 859 in "vm.c"
  [9] scm_to_stringn(str = 0x4e3620, lenp = (nil), encoding = 0x7ffffff05411 "ISO-8859-1", handler = SCM_FAILED_CONVERSION_QUESTION_MARK), line 1966 in "strings.c"
  [10] search_path(path = 0x4e2360, filename = 0x4e3620, extensions = 0x304, require_exts = 0x4, stat_buf = 0xfffffd7fffdfe330), line 444 in "load.c"
  [11] scm_init_eval_in_scheme(), line 971 in "load.c"
  [12] scm_i_init_guile(base = 0x7ffffff04bb4), line 499 in "init.c"
  [13] scm_i_init_thread_for_guile(base = 0xfffffd7fffdfe460, parent = (nil)), line 829 in "threads.c"
  [14] with_guile_and_parent(base = 0xfffffd7fffdfe460, data = (nil)), line 895 in "threads.c"
  [15] GC_call_with_stack_base(fn = (nil), arg = (nil)), line 1530 in "misc.c"
  [16] scm_i_with_guile_and_parent(func = (nil), data = (nil), parent = (nil)), line 945 in "threads.c"
  [17] scm_boot_guile(argc = 0, argv = (nil), main_func = (nil), closure = (nil)), line 319 in "init.c"
  [18] main(argc = 0, argv = (nil)), line 71 in "guile.c"

Regard,

-- Kiyoshi <[email-masked]>

--- On Wed, 2012/4/11, Mark H Weaver <[email-masked]> wrote:

> Hi Kiyoshi,
> 
> I wrote:
> > It appears that 'environ_locale_charset' returns a bad address on
> > Solaris 10, but only when Guile is compiled with '-m64'.
> 
> Kiyoshi: would you be willing to help investigate further?  I would
> recommend running the 64-bit version of Guile in a debugger, setting a
> breakpoint on 'environ_locale_charset' and stepping through that
> function to find out more precisely where the bad pointer originates.
> 
>     Regards,
>       Mark
> 
> 
> > Kiyoshi KANAZAWA <[email-masked]> writes:
> >> =>[1] libunistring_c_strcasecmp(s1 = <value unavailable>, s2 =
> >> <value unavailable>) (optimized), at 0x7fffffa102a8 (line ~39) in
> >> "c-strcasecmp.c"
> >>   [2] u8_conv_from_encoding(fromcode = 0xfffffffffff56ea0 "<bad
> >> address 0xfffffffffff56ea0>", handler = iconveh_escape_sequence, src
> >> = 0xfffffd7fffdff6ea "snarf-check-and-output-texi", srclen = 27U,
> >> offsets = (nil), resultbuf = (nil), lengthp = 0xfffffd7fffdfecf8)
> >> (optimized), at 0x7fffffa1ce80 (line ~39) in "u8-conv-from-enc.c"
> >>   [3] u32_conv_from_encoding(fromcode = <value unavailable>, handler
> >> = <value unavailable>, src = <value unavailable>, srclen = 27U,
> >> offsets = (nil), resultbuf = (nil), lengthp = 0xfffffd7fffdfed60)
> >> (optimized), at 0x7fffffa1c730 (line ~52) in "u-conv-from-enc.h"
> >>   [4] scm_from_stringn(str = 0xfffffd7fffdff6ea
> >> "snarf-check-and-output-texi", len = 27U, encoding =
> >> 0xfffffffffff56ea0 "<bad address 0xfffffffffff56ea0>", handler =
> >> SCM_FAILED_CONVERSION_ESCAPE_SEQUENCE), line 1515 in "strings.c"
> >
> > Note the bad 'encoding' parameter above.
> >
> >>   [5] locale_arguments_to_string_list(argc = 5, argv = 0xfffffd7fffdff478), line 394 in "script.c"
> >>   [6] scm_i_set_boot_program_arguments(argc = 0, argv = (nil)), line 405 in "script.c"
> >>   [7] invoke_main_func(body_data = 0xfffffd7fffdff420), line 335 in "init.c"
> >>   [8] c_body(d = 0xfffffd7fffdff370), line 512 in "continuations.c"
> >>   [9] vm_regular_engine(vm = 0x4da270, program = 0x3679880, argv = 0x7fffffec7210, nargs = 1), line 960 in "vm-i-system.c"
> >>   [10] scm_c_vm_run(vm = 0x4da270, program = 0x3679a80, argv = 0xfffffd7fffdfef70, nargs = 0), line 567 in "vm.c"
> >>   [11] eval(x = 0x589570, env = 0x3681820), line 341 in "eval.c"
> >>   [12] eval(x = 0x5893b0, env = 0x3681820), line 297 in "eval.c"
> >>   [13] eval(x = 0x4f0920, env = 0x36817f0), line 462 in "eval.c"
> >>   [14] boot_closure_apply(closure = (nil), args = (nil)), line 956 in "eval.c"
> >>   [15] vm_regular_engine(vm = 0x4da270, program = 0x36799e0, argv = 0x7fffffe53260, nargs = 1), line 960 in "vm-i-system.c"
> >>   [16] scm_c_vm_run(vm = 0x4da270, program = 0x5011c0, argv = 0xfffffd7fffdff2c0, nargs = 4), line 567 in "vm.c"
> >>   [17] scm_call_4(proc = 0x5011c0, arg1 = (nil), arg2 = (nil), arg3 = (nil), arg4 = (nil)), line 507 in "eval.c"
> >>   [18] scm_i_with_continuation_barrier(body = 0x7fffffe49e70 =
> >> &`libguile-2.0.so.22.4.0`continuations.c`c_body(register void *d),
> >> body_data = 0xfffffd7fffdff370, handler = 0x7fffffe49ea0 =
> >> &`libguile-2.0.so.22.4.0`continuations.c`c_handler(register void *d,
> >> register SCM tag, register SCM args), handler_data =
> >> 0xfffffd7fffdff370, pre_unwind_handler = 0x7fffffe49f00 =
> >> &`libguile-2.0.so.22.4.0`continuations.c`pre_unwind_handler(register
> >> void *error_port, register SCM tag, register SCM args),
> >> pre_unwind_handler_data = 0x4da1a0), line 450 in "continuations.c"
> >>   [19] scm_c_with_continuation_barrier(func = (nil), data = (nil)), line 546 in "continuations.c"
> >>   [20] with_guile_and_parent(base = 0xfffffd7fffdff3d0, data = (nil)), line 902 in "threads.c"
> >>   [21] GC_call_with_stack_base(fn = (nil), arg = (nil)), line 1530 in "misc.c"
> >>   [22] scm_i_with_guile_and_parent(func = (nil), data = (nil), parent = (nil)), line 945 in "threads.c"
> >>   [23] scm_boot_guile(argc = 0, argv = (nil), main_func = (nil), closure = (nil)), line 319 in "init.c"
> >>   [24] main(argc = 0, argv = (nil)), line 71 in "guile.c"
> >> (dbx)
>