Revision 4006e6d9e69982688d35e6713b5991bfbef6b056. Happens on every data set I've tried (including enwik8 and zling.c). Fedora 20, GCC 4.8.2, x86_64.
The segfault comes from line 735, but valgrind detects problems before that:
nemequ@hoplite:~/local/src/zling$ (./zling e zling.c) | valgrind --tool=memcheck ./zling d
zling:
light-weight lossless data compression utility
by Zhang Li <zhangli10 at baidu.com>
0.03 MB => 0.00 MB 11.45%, 0.005 sec
encode: 27177 => 3112, time=0.006 sec
time_rolz: 0.001 sec
time_polar: 0.000 sec
==6441== Memcheck, a memory error detector
==6441== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==6441== Using Valgrind-3.9.0 and LibVEX; rerun with -h for copyright info
==6441== Command: ./zling d
==6441==
zling:
light-weight lossless data compression utility
by Zhang Li <zhangli10 at baidu.com>
==6441== Conditional jump or move depends on uninitialised value(s)
==6441== at 0x4023C7: polar_make_code_table (zling.c:188)
==6441== by 0x401C07: main (zling.c:723)
==6441==
==6441== Conditional jump or move depends on uninitialised value(s)
==6441== at 0x401CB6: main (zling.c:216)
==6441==
==6441== Invalid read of size 4
==6441== at 0x401D8E: main (zling.c:735)
==6441== Address 0xfff01f30c is not stack'd, malloc'd or (recently) free'd
==6441==
==6441==
==6441== Process terminating with default action of signal 11 (SIGSEGV)
==6441== Access not within mapped region at address 0xFFF01F30C
==6441== at 0x401D8E: main (zling.c:735)
==6441== If you believe this happened as a result of a stack
==6441== overflow in your program's main thread (unlikely but
==6441== possible), you can try to increase the size of the
==6441== main thread stack using the --main-stacksize= flag.
==6441== The main thread stack size used in this run was 8388608.
==6441==
==6441== HEAP SUMMARY:
==6441== in use at exit: 4,195,328 bytes in 1 blocks
==6441== total heap usage: 1 allocs, 0 frees, 4,195,328 bytes allocated
==6441==
==6441== LEAK SUMMARY:
==6441== definitely lost: 4,195,328 bytes in 1 blocks
==6441== indirectly lost: 0 bytes in 0 blocks
==6441== possibly lost: 0 bytes in 0 blocks
==6441== still reachable: 0 bytes in 0 blocks
==6441== suppressed: 0 bytes in 0 blocks
==6441== Rerun with --leak-check=full to see details of leaked memory
==6441==
==6441== For counts of detected and suppressed errors, rerun with: -v
==6441== Use --track-origins=yes to see where uninitialised values come from
==6441== ERROR SUMMARY: 5633 errors from 3 contexts (suppressed: 2 from 2)
Segmentation fault (core dumped)
Revision 4006e6d9e69982688d35e6713b5991bfbef6b056. Happens on every data set I've tried (including enwik8 and zling.c). Fedora 20, GCC 4.8.2, x86_64.
The segfault comes from line 735, but valgrind detects problems before that: