tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Segfault compiling bash?


From: charlesrandall4-tinycc
Subject: [Tinycc-devel] Segfault compiling bash?
Date: Sat, 30 Oct 2004 22:20:23 -0700 (PDT)

I'm new to tcc and am trying to compile a number of
different programs to see how well it would work in
"real life".

Attempting to compile bash-3.0 using tcc 0.9.21 on
RedHat Linux 9 and run into the following problem,

tcc  -DPROGRAM='"bash"' -DCONF_HOSTTYPE='"i686"'
-DCONF_OSTYPE='"linux-gnu"'
-DCONF_MACHTYPE='"i686-pc-linux-gnu"'
-DCONF_VENDOR='"pc"'
-DLOCALEDIR='"/tmp/cfr/share/locale"'
-DPACKAGE='"bash"' -DSHELL -DHAVE_CONFIG_H  -I.  -I.
-I./include -I./lib   -g -c variables.c
variables.c:1981: constant expression expected
make: *** [variables.o] Segmentation fault

If I try to run tcc_g in the debugger the backtrace
is,

gdb ~/src/tcc-0.9.21/tcc_g
GNU gdb Red Hat Linux (5.3post-0.20021129.18rh)
Copyright 2003 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 "i386-redhat-linux-gnu"...
(gdb) run -DPROGRAM='"bash"' -DCONF_HOSTTYPE='"i686"'
-DCONF_OSTYPE='"linux-gnu"'
-DCONF_MACHTYPE='"i686-pc-linux-gnu"'
-DCONF_VENDOR='"pc"'
-DLOCALEDIR='"/tmp/cfr/share/locale"'
-DPACKAGE='"bash"' -DSHELL -DHAVE_CONFIG_H  -I.  -I.
-I./include -I./lib   -g -c variables.c
Starting program: /home/crandall/src/tcc-0.9.21/tcc_g
-DPROGRAM='"bash"' -DCONF_HOSTTYPE='"i686"'
-DCONF_OSTYPE='"linux-gnu"'
-DCONF_MACHTYPE='"i686-pc-linux-gnu"'
-DCONF_VENDOR='"pc"'
-DLOCALEDIR='"/tmp/cfr/share/locale"'
-DPACKAGE='"bash"' -DSHELL -DHAVE_CONFIG_H  -I.  -I.
-I./include -I./lib   -g -c variables.c
variables.c:1981: constant expression expected

Program received signal SIGSEGV, Segmentation fault.
0x0804c667 in tok_str_free (str=0x2f0) at tcc.c:2230
2230            t = *p;
(gdb) bt
#0  0x0804c667 in tok_str_free (str=0x2f0) at
tcc.c:2230
#1  0x08056db9 in gen_inline_functions () at
tcc.c:8759
#2  0x0805748b in tcc_compile (s1=0x8072748) at
tcc.c:9039
#3  0x0805fe44 in tcc_add_file_internal (s1=0x8072748,
    filename=0xbffffa7b "variables.c", flags=1) at
tcc.c:9663
#4  0x08060048 in tcc_add_file (s=0x8072748,
filename=0xbffffa7b "variables.c")
    at tcc.c:9740
#5  0x08060d93 in main (argc=17, argv=0xbffff824) at
tcc.c:10382
#6  0x420156a4 in __libc_start_main () from
/lib/tls/libc.so.6
(gdb) l
2225        CString *cstr;
2226        int t;
2227
2228        p = str;
2229        for(;;) {
2230            t = *p;
2231            /* NOTE: we test zero separately so
that GCC can generate a
2232               table for the following switch */
2233            if (t == 0)
2234                break;
(gdb) p str
$1 = (int *) 0x2f0
(gdb) p *str
Cannot access memory at address 0x2f0
(gdb) up
#1  0x08056db9 in gen_inline_functions () at
tcc.c:8759
8759                tok_str_free(str);
(gdb) p str
$2 = (int *) 0x2f0
(gdb) l
8754            type = &sym->type;
8755            if (((type->t & VT_BTYPE) == VT_FUNC)
&&
8756                (type->t & (VT_STATIC |
VT_INLINE)) ==
8757                (VT_STATIC | VT_INLINE)) {
8758                str = (int *)sym->r;
8759                tok_str_free(str);
8760                sym->r = 0; /* fail safe */
8761            }
8762        }
8763    }
(gdb) p sym
$3 = (Sym *) 0x8174968
(gdb) p *sym
$4 = {v = 6300, r = 752, c = 0, type = {t = 1414, ref
= 0x81748f0},
  next = 0x0, prev = 0x81748f0, prev_tok = 0x0}

Has anyone looked at this?

-Charles







reply via email to

[Prev in Thread] Current Thread [Next in Thread]