Bug 16477

Summary: uim-module-manager segv on IA64
Product: UIM Reporter: Masahito Omote <omote>
Component: libuim: Scheme interpreterAssignee: uim-bugs
Status: RESOLVED WORKSFORME QA Contact:
Severity: blocker    
Priority: high    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Masahito Omote 2008-06-23 07:43:02 UTC
As described above, uim-module-manager segv on IA64.

Here is the result of gdb backtrace. And full compilation log are avalable at 
http://buildd.debian.org/fetch.cgi?&pkg=uim&ver=1%3A1.5.1-1&arch=ia64&stamp=1211829196&file=log

merulo% LD_LIBRARY_PATH=../uim/.libs LIBUIM_SYSTEM_SCM_FILES=/home/omote/uim/uim
-1.5.1/sigscheme/lib LIBUIM_SCM_FILES=/home/omote/uim/uim-1.5.1/scm LIBUIM_PLUGI
N_LIB_DIR=/home/omote/uim/uim-1.5.1/uim/.libs gdb ../uim/.libs/uim-module-manage
r
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "ia64-linux-gnu"...
(gdb) set args --path ../scm --register "skk" "tcode" "trycode" "tutcode" "byeor
u" "latin" "elatin" "pyload" "hangul" "viqr" "ipa-x-sampa" "look"
(gdb) r
Starting program: /home/omote/uim/uim-1.5.1/uim/.libs/uim-module-manager --path 
../scm --register "skk" "tcode" "trycode" "tutcode" "byeoru" "latin" "elatin" "p
yload" "hangul" "viqr" "ipa-x-sampa" "look"

Program received signal SIGSEGV, Segmentation fault.
read_token (port=2305843009217572404, err=0x60000fffff023430, buf=0x0,
    buf_size=<value optimized out>, delim=SCM_CH_DELIMITER)
    at ../sigscheme/src/read.c:501
    at ../sigscheme/src/read.c:501
501                 *p++ = c;
(gdb) bt
#0  read_token (port=2305843009217572404, err=0x60000fffff023430, buf=0x0,
    buf_size=<value optimized out>, delim=SCM_CH_DELIMITER)
    at ../sigscheme/src/read.c:501
#1  0x200000000007b980 in read_symbol (port=2305843009217572404)
    at ../sigscheme/src/read.c:927
#2  0x2000000000084820 in read_sexpression (port=2305843009217572404)
    at ../sigscheme/src/read.c:988
#3  0x2000000000087c80 in read_list (port=2305843009217572404,
    closing_paren=41) at ../sigscheme/src/read.c:705
#4  0x2000000000084b70 in read_sexpression (port=2305843009217572404)
    at ../sigscheme/src/read.c:541
#5  0x2000000000087c80 in read_list (port=2305843009217572404,
    closing_paren=41) at ../sigscheme/src/read.c:705
#6  0x2000000000084b70 in read_sexpression (port=2305843009217572404)
    at ../sigscheme/src/read.c:541
#7  0x2000000000085cd0 in scm_load_internal (filename=<value optimized out>)
    at ../sigscheme/src/read.c:413
#8  0x2000000000086370 in scm_p_load (filename=2305843009217572372)
    at ../sigscheme/src/load.c:281
#9  0x2000000000087940 in scm_initialize_internal (argv=0x60000fffff023750)
    at ../sigscheme/src/sigscheme.c:360
#10 0x2000000000385630 in GCROOTS_call_with_gc_ready_stack (
    ctx=0x6000000000004130, proc=0x200000000004be08, arg=0x60000fffff023750)
---Type <return> to continue, or q <return> to quit---
    at gcroots.c:114
#11 0x2000000000070f70 in uim_scm_init (system_load_path=<value optimized out>)
    at ../sigscheme/src/storage-gc.c:376
#12 0x20000000000beb30 in uim_init () at uim.c:108
#13 0x4000000000001740 in main (argc=16, argv=0x60000fffff023a48)
    at uim-module-manager.c:180
Comment 1 Etsushi Kato 2008-06-24 00:57:06 UTC
(In reply to comment #0)
> As described above, uim-module-manager segv on IA64.
> 
> Here is the result of gdb backtrace. And full compilation log are avalable at 
> http://buildd.debian.org/fetch.cgi?&pkg=uim&ver=1%3A1.5.1-1&arch=ia64&stamp=1211829196&file=log

Possibly OS and/or GCC version specific issue?

I don't see any problem on ia64 (Itanium 2) SUSE Linux (with kernel 2.6.16.27, glibc-2.4, and gcc-4.1).  uim 1.5.1 compiles flawlessly on this, and works well in a casual test using uim-fep (with module_names = "tcode" "trycode" "tutcode" "byeoru" "latin" "elatin" "pyload" "hangul" "viqr" "ipa-x-sampa" "look" ).

I'll try with GCC-4.3.1 on SUSE ia64 later.
Comment 2 Etsushi Kato 2008-06-24 03:07:13 UTC
OK, that must be realted to GCC 4.3 on IA-64.  I can reproduce the segfault with uim 1.5.1 on ia64 SUSE Linux using GCC 4.3.1.
Comment 3 Etsushi Kato 2008-06-24 03:17:46 UTC
(In reply to comment #2)
> OK, that must be realted to GCC 4.3 on IA-64.  I can reproduce the segfault
> with uim 1.5.1 on ia64 SUSE Linux using GCC 4.3.1.

And found that compiling uim-scm-sigscheme.c with -O0 instead of -O2 should be a workaround for GCC 4.3 on IA64.  Does it work for you, Omote san?
Comment 4 Etsushi Kato 2008-06-24 19:02:07 UTC
(In reply to comment #3)
> And found that compiling uim-scm-sigscheme.c with -O0 instead of -O2 should be
> a workaround for GCC 4.3 on IA64.  Does it work for you, Omote san?

Another way to avoid GCC 4.3's optimization problem on IA64 is just assign something in init_buf[] in read_symbol().  For example, following change in  sigscheme/src/read.c will stop the segfault even with -O2 using GCC 4.3.1 on SUSE.


--- read.c.orig 2008-03-01 23:30:43.000000000 +0900
+++ read.c      2008-06-25 10:50:46.000000000 +0900
@@ -918,6 +918,7 @@
     int err;
     ScmLBuf(char) lbuf;
     char init_buf[SCM_INITIAL_SYMBOL_BUF_SIZE];
+    init_buf[0] = '\0';

     CDBG((SCM_DBG_PARSER, "read_symbol"));
Comment 5 Masahito Omote 2008-06-25 00:49:06 UTC
(In reply to comment #4)
> (In reply to comment #3)
> > And found that compiling uim-scm-sigscheme.c with -O0 instead of -O2 should be
> > a workaround for GCC 4.3 on IA64.  Does it work for you, Omote san?
> 

First workaround does not work well on Debian.

make  -C ../uim uim-module-manager && \
    LIBUIM_SYSTEM_SCM_FILES=/home/omote/uim/uim-1.5.1/sigscheme/lib LIBUIM_SCM_FILES=/home/omote/uim/uim-1.5.1/scm LIBUIM_PLUGIN_LIB_DIR=/home/omote/uim/uim-1.5.1/uim/.libs ../uim/uim-module-manager \
        --path ../scm --register        "skk" "tcode" "trycode" "tutcode" "byeoru" "latin" "elatin"  "pyload" "hangul" "viqr" "ipa-x-sampa" "look"
make[2]: Entering directory `/home/omote/uim/uim-1.5.1/uim'
make[2]: `uim-module-manager' is up to date.
make[2]: Leaving directory `/home/omote/uim/uim-1.5.1/uim'
lt-uim-module-manager: ../sigscheme/src/storage-gc.c:640: within_heapp: Assertion `!((scm_uintobj_t)(((obj) & ~((((scm_uintobj_t)1 << ((0) + (1))) - ((scm_uintobj_t)1 << (0))) | (((scm_uintobj_t)1 << (((1 + 0)) + (2))) - ((scm_uintobj_t)1 << ((1 + 0))))))) % sizeof(ScmCell))' failed.
/bin/sh: line 2: 18010 Aborted                 LIBUIM_SYSTEM_SCM_FILES=/home/omote/uim/uim-1.5.1/sigscheme/lib LIBUIM_SCM_FILES=/home/omote/uim/uim-1.5.1/scm LIBUIM_PLUGIN_LIB_DIR=/home/omote/uim/uim-1.5.1/uim/.libs ../uim/uim-module-manager --path ../scm --register "skk" "tcode" "trycode" "tutcode" "byeoru" "latin" "elatin" "pyload" "hangul" "viqr" "ipa-x-sampa" "look"
make[1]: *** [installed-modules.scm] Error 134
make[1]: Leaving directory `/home/omote/uim/uim-1.5.1/scm'
make: *** [all-recursive] Error 1
merulo%

> Another way to avoid GCC 4.3's optimization problem on IA64 is just assign
> something in init_buf[] in read_symbol().  For example, following change in 
> sigscheme/src/read.c will stop the segfault even with -O2 using GCC 4.3.1 on
> SUSE.
> 
> 
> --- read.c.orig 2008-03-01 23:30:43.000000000 +0900
> +++ read.c      2008-06-25 10:50:46.000000000 +0900
> @@ -918,6 +918,7 @@
>      int err;
>      ScmLBuf(char) lbuf;
>      char init_buf[SCM_INITIAL_SYMBOL_BUF_SIZE];
> +    init_buf[0] = '\0';
> 
>      CDBG((SCM_DBG_PARSER, "read_symbol"));
> 

This workaround works out well. I take this workaround. Thank you.
Comment 6 Etsushi Kato 2010-08-11 17:48:58 UTC
Cannot reproduce with uim 1.6.0.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.