Menu

fommy_hashlin_done: warning: free called on pointer with nonzero offset

Help
Jon Ringle
2023-10-19
2023-10-20
  • Jon Ringle

    Jon Ringle - 2023-10-19

    I am seeing the following compiler warning:

    c_src/tommyds/src/tommyhashlin.c: In function tommy_hashlin_done:
    c_src/tommyds/src/tommytypes.h:102:20: warning: free called on pointer *(tommy_hashlin_node ***)((char *)hashlin+ ivtmp*8) with nonzero offset [512, 17179869184] [-Wfree-nonheap-object]
      102 | #define tommy_free free
    c_src/tommyds/src/tommyhashlin.c:82:17: note: in expansion of macro tommy_free
       82 |                 tommy_free(&segment[((tommy_ptrdiff_t)1) << i]);
          |                 ^~~~~~~~~~
    
     
  • Andrea Mazzoleni

    Hi Jon,

    I checked the code and it's right. It looks like as a false positive warning from the compiler.

    What compiler and version is it ?

    Ciao,
    Andrea

     
  • Jon Ringle

    Jon Ringle - 2023-10-20

    gcc (Ubuntu 11.4.0-2ubuntu1~20.04) 11.4.0

     

Log in to post a comment.