Git Product home page Git Product logo

critbit's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

critbit's Issues

compilation failed

typing "make" doesn't work.
The file "bsd.prog.mk" is missing.
Could you add it the repo.

segfault running critbit test

$ gcc -g -O3 -flto -fwhole-program critbit.c critbit-test.c -o critbit-test
$ ./critbit-test 
     critbit int: 2000 iterations in 1.887146 seconds; 1059.801414 iterations/s
critbit hash int: 2000 iterations in 2.405879 seconds; 831.297002 iterations/s
      rbtree int: 2000 iterations in 1.543369 seconds; 1295.866381 iterations/s
     nrbtree int: 2000 iterations in 1.471779 seconds; 1358.899672 iterations/s
The process was killed by SIGSEGV: Segmentation fault
$ gdb ./critbit-test 
GNU gdb (GDB) 7.11.1
Copyright (C) 2016 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 "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./critbit-test...done.
(gdb) r
Reading symbols from lib_libc.so.dbg...     critbit int: 2000 iterations in 1.877919 seconds; 1065.008661 iterations/s
critbit hash int: 2000 iterations in 2.412311 seconds; 829.080496 iterations/s
      rbtree int: 2000 iterations in 1.540637 seconds; 1298.164331 iterations/s
     nrbtree int: 2000 iterations in 1.468241 seconds; 1362.174193 iterations/s

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7db55f5 in strlen (
    s=0x6a25203a73363125 <error: Cannot access memory at address 0x6a25203a73363125>) at src/string/strlen.c:16
16      src/string/strlen.c: No such file or directory.
(gdb) bt
#0  0x00007ffff7db55f5 in strlen (
    s=0x6a25203a73363125 <error: Cannot access memory at address 0x6a25203a73363125>) at src/string/strlen.c:16
#1  0x00000000004028bc in critbit_str_keylen () at critbit.c:107
#2  critbit_str_insert.lto_priv.13 (t=0x7fffffffe9e0, newnode=0x7ffff7f1ad30, 
    key=0x7ffff7f4b318) at critbit.c:336
#3  0x0000000000401781 in eltree_critbit_insert () at critbit-test.c:39
#4  test_benchmark_critbit () at critbit-test.c:375
#5  main () at critbit-test.c:516
(gdb) up
#1  0x00000000004028bc in critbit_str_keylen () at critbit.c:107
107             return (strlen((char *)a));
(gdb) l
102     }
103
104     static __inline size_t
105     critbit_str_keylen(struct critbit_tree *t CRITBIT_UNUSED, const uint8_t *a)
106     {
107             return (strlen((char *)a));
108     }
109
110     static __inline int
111     critbit_buf_keycmp(const uint8_t *a, const uint8_t *b, size_t blen)
(gdb) p a
$1 = (const uint8_t *) 0x6a25203a73363125 <error: Cannot access memory at address 0x6a25203a73363125>
(gdb) up
#2  critbit_str_insert.lto_priv.13 (t=0x7fffffffe9e0, newnode=0x7ffff7f1ad30, 
    key=0x7ffff7f4b318) at critbit.c:336
336             return (critbit_insert_impl(t, newnode, (const struct critbit_key *)key,
(gdb) p key
$2 = (const char **) 0x7ffff7f4b318
(gdb) p *key
$3 = 0x6a25203a73363125 <error: Cannot access memory at address 0x6a25203a73363125>
(gdb) #6a 25 20 3a 73 36 31 25
(gdb) p/c 0x6a
$4 = 106 'j'
(gdb) p/c 0x25
$5 = 37 '%'
(gdb) p/c 0x3a
$6 = 58 ':'
(gdb) p/c 0x73
$7 = 115 's'
(gdb) p/c 0x36
$8 = 54 '6'
(gdb) p/c 0x31
$9 = 49 '1'
(gdb) p/c 0x25
$10 = 37 '%'
(gdb) up
#3  0x0000000000401781 in eltree_critbit_insert () at critbit-test.c:39
39      CRITBIT_GENERATE_STATIC(eltree, element, str, k);
(gdb) l
34              RB_ENTRY(element) rbentry;
35              rb_node(struct element) nrb_link;
36      };
37
38      CRITBIT_HEAD_PROTOTYPE(eltree);
39      CRITBIT_GENERATE_STATIC(eltree, element, str, k);
40
41      CRITBIT_HEAD_PROTOTYPE(elinttree);
42      CRITBIT_GENERATE_STATIC(elinttree, element, int64, kint);
43

from first brief investigation it appears there's a mismatch between char** vs char* logic. the former is only used for string type keys, but i didn't get a sufficient understanding of the code yet to see why that's needed. there's also the remote possibility GCC has a codegen bug (because the segfault happens only with the CFLAGS in the paste.
this happens with gcc 6.5.0, musl libc 1.2.2 on linux x86_64.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.