[gcc-4.4.5] wrong code, segfault in libtommath-0.42.0 with "-O2 -fgraphite-identity"

Marcin Mirosław marcin@mejor.pl
Wed Jun 15 17:02:00 GMT 2011


Hello,
I'm not sure this bug should be posted here, in gcc/bugzilla or should i
write to libtommath's upstream.
Problem appears when i run freshclam, it segfaults. I run under gbd and
i got:

(gdb) run
Starting program: /usr/bin/freshclam
[Thread debugging using libthread_db enabled]
ClamAV update process started at Wed Jun 15 12:21:36 2011
main.cvd is up to date (version: 53, sigs: 846214, f-level: 53, builder:
sven)
daily.cld is up to date (version: 13192, sigs: 127098, f-level: 60,
builder: ccordes)
bytecode.cld is up to date (version: 143, sigs: 40, f-level: 60,
builder: edwin)

Program received signal SIGSEGV, Segmentation fault.
0xb723dde2 in mp_clamp () from /usr/lib/libtommath.so.0
(gdb) thread apply all bt full

Thread 1 (Thread 0xb71f16d0 (LWP 25751)):
#0  0xb723dde2 in mp_clamp () from /usr/lib/libtommath.so.0
No symbol table info available.
#1  0xb723d076 in fast_mp_montgomery_reduce () from /usr/lib/libtommath.so.0
No symbol table info available.
#2  0xb723f7ed in mp_exptmod_fast () from /usr/lib/libtommath.so.0
No symbol table info available.
#3  0xb723fe86 in mp_exptmod () from /usr/lib/libtommath.so.0
No symbol table info available.
#4  0xb7584e43 in cli_decodesig () at dsig.c:92
No locals.
#5  0xb758529d in cli_versig2 () at dsig.c:167
No locals.
#6  0xb7580e39 in cli_load () at readdb.c:1684
        ftypes_int = {0xb7ddc3a4 "0:0:000001b3:MPEG video
stream:CL_TYPE_ANY:CL_TYPE_IGNORED",
0xb7ddc3e0 "0:0:000001ba:MPEG sys stream:CL_TYPE_ANY:CL_TYPE_IGNORED",
0xb7ddc41c "0:0:1f8b:GZip:CL_TYPE_ANY:CL_TYPE_GZ",
          0xb7ddc444 "0:0:23407e5e:SCRENC:CL_TYPE_ANY:CL_TYPE_SCRENC",
0xb7ddc474
"0:0:252150532d41646f62652d:PostScript:CL_TYPE_ANY:CL_TYPE_IGNORED",
          0xb7ddc4b8 "0:0:255044462d:PDF document:CL_TYPE_ANY:CL_TYPE_PDF",
          0xb7ddc4ec
"0:0:28546869732066696c65206d75737420626520636f6e76657274656420776974682042696e48657820342e3029:BinHex:CL_TYPE_ANY:CL_TYPE_BINHEX",

          0xb7ddc570 "0:0:2e524d46:Real Media
File:CL_TYPE_ANY:CL_TYPE_IGNORED", 0xb7ddc5ac
"0:0:3e46726f6d20:Mail:CL_TYPE_ANY:CL_TYPE_MAIL",
          0xb7ddc5dc "0:0:424d:BMP:CL_TYPE_ANY:CL_TYPE_GRAPHICS",
0xb7ddc608 "0:0:425a68:BZip:CL_TYPE_ANY:CL_TYPE_BZ",

[...]

0xb7dddcac "1:*:496e7374616c6c536869656c6400{292}06", '0' <repeats 14
times>, '?' <repeats 16 times>,
"0000000001:ISHIELD-MSI:CL_TYPE_ANY:CL_TYPE_ISHIELD_MS
I:45", 0xb7dddd2c "0:0:377abcaf271c:7zip:CL_TYPE_ANY:CL_TYPE_7Z:47",
0xb7dddd5c "0:0:52656365697665642d5350463a20:Mail
file:CL_TYPE_ANY:CL_TYPE_MAIL",
          0xb7dddda0
"1:0,2048:0a(52|72)656365697665643a20{-2048}0a(43|63)6f6e74656e742d(54|74)7970653a20:Mail
file:CL_TYPE_ANY:CL_TYPE_MAIL",
          0xb7ddde18 "0:0:303730373031:CPIO
NEWC:CL_TYPE_ANY:CL_TYPE_CPIO_NEWC:45", 0xb7ddde54
"0:0:303730373032:CPIO CRC:CL_TYPE_ANY:CL_TYPE_CPIO_CRC:45",
          0xb7ddde90 "0:0:303730373037:CPIO
ODC:CL_TYPE_ANY:CL_TYPE_CPIO_ODC:45", 0xb7dddecc "0:0:71c7:CPIO OLD
BINARY BE:CL_TYPE_ANY:CL_TYPE_CPIO_OLD:45",
          0xb7dddf08 "0:0:c771:CPIO OLD BINARY
LE:CL_TYPE_ANY:CL_TYPE_CPIO_OLD:45", 0x0}
        cli_mtargets = {{target = CL_TYPE_ANY, name = 0xb7dd8d31
"GENERIC", idx = 0 '\000', ac_only = 0 '\000', enable_prefiltering = 1
'\001'}, {
            target = CL_TYPE_MSEXE, name = 0xb7f6b4bd "PE", idx = 1
'\001', ac_only = 0 '\000', enable_prefiltering = 1 '\001'}, {target =
CL_TYPE_MSOLE2,
            name = 0xb7de0465 "OLE2", idx = 2 '\002', ac_only = 1
'\001', enable_prefiltering = 0 '\000'}, {target = CL_TYPE_HTML, name =
0xb7de053f "HTML",
            idx = 3 '\003', ac_only = 1 '\001', enable_prefiltering = 0
'\000'}, {target = CL_TYPE_MAIL, name = 0xb7de054c "MAIL", idx = 4 '\004',
            ac_only = 1 '\001', enable_prefiltering = 1 '\001'}, {target
= CL_TYPE_GRAPHICS, name = 0xb7de04a9 "GRAPHICS", idx = 5 '\005',
ac_only = 1 '\001',
            enable_prefiltering = 0 '\000'}, {target = CL_TYPE_ELF, name
= 0xb7de0384 "ELF", idx = 6 '\006', ac_only = 1 '\001',
enable_prefiltering = 0 '\000'}, {
            target = CL_TYPE_TEXT_ASCII, name = 0xb7de02fc "ASCII", idx
= 7 '\a', ac_only = 1 '\001', enable_prefiltering = 1 '\001'}, {target =
CL_TYPE_ERROR,
---Type <return> to continue, or q <return> to quit---
            name = 0xb7dd8d39 "NOT USED", idx = 8 '\b', ac_only = 1
'\001', enable_prefiltering = 0 '\000'}, {target = CL_TYPE_MACHO, name =
0xb7dd8d42 "MACH-O",
            idx = 9 '\t', ac_only = 1 '\001', enable_prefiltering = 0
'\000'}}
        cli_ref_mutex = {__data = {__lock = 0, __count = 0, __owner = 0,
__kind = 0, __nusers = 0, {__spins = 0, __list = {__next = 0x0}}},
          __size = '\000' <repeats 23 times>, __align = 0}
#7  0xb758382c in cli_tgzload () at cvd.c:311
No locals.
#8  0xb7584735 in cli_cvdload () at cvd.c:634
No locals.
#9  0xb7584b0d in cl_cvdverify () at cvd.c:558
No locals.
#10 0xb7ff042f in downloadmanager () at manager.c:1596
No locals.
#11 0xb7fe89a1 in download () at freshclam.c:181
        terminate = 0
        foreground = 1
        updtmpdir =
"/var/lib/clamav/clamav-c48305fdddcda8b3bd23c8c031c9b9c7", '\000'
<repeats 456 times>
        dbdir = "/var/lib/clamav", '\000' <repeats 496 times>
        sigchld_wait = 1
#12 0xb7fe98cb in main () at freshclam.c:532
        terminate = 0
        foreground = 1
        updtmpdir =
"/var/lib/clamav/clamav-c48305fdddcda8b3bd23c8c031c9b9c7", '\000'
<repeats 456 times>
        dbdir = "/var/lib/clamav", '\000' <repeats 496 times>
        sigchld_wait = 1
(gdb)

gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with:
/var/tmp/portage/sys-devel/gcc-4.4.5/work/gcc-4.4.5/configure
--prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.4.5
--includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.4.5/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.4.5
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.4.5/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.4.5/info
--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.4.5/include/g++-v4
--host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec
--disable-fixed-point --with-ppl --with-cloog
--disable-ppl-version-check --with-cloog-include=/usr/include/cloog
--enable-nls --without-included-gettext --with-system-zlib
--disable-werror --enable-secureplt --disable-multilib
--enable-libmudflap --disable-libssp --enable-esp --enable-libgomp
--with-python-dir=/share/gcc-data/i686-pc-linux-gnu/4.4.5/python
--enable-checking=release --disable-libgcj --with-arch=i686
--enable-languages=c,c++ --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu
--with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo Hardened
4.4.5 p1.2, pie-0.4.5'
Thread model: posix
gcc version 4.4.5 (Gentoo Hardened 4.4.5 p1.2, pie-0.4.5)

I can submit preprocessed file(s) but i don't know which one. I'm have
no C skills, please don't shoot me:)
Thanks



More information about the Gcc-help mailing list