ruanjue / wtdbg2

Redbean: A fuzzy Bruijn graph approach to long noisy reads assembly
GNU General Public License v3.0
512 stars 94 forks source link

exceeding maximum object size (-Walloc-size-larger-than) #186

Closed Smattr closed 4 years ago

Smattr commented 4 years ago

GCC 8.3.0 says the following when compiling non-debug:

...
gcc -g3 -W -Wall -Wno-unused-but-set-variable -O4 -DVERSION="2.5" -DRELEASE="20190621" -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -mpopcnt -msse4.2 -o kbm2 kbm.c ksw.c -lm -lrt -lpthread -lz
In file included from kbm.h:24,
                 from kbm.c:20:
In function ‘init2_kbmhash.constprop’,
    inlined from ‘init_kbmhash’ at kbm.h:99:1,
    inlined from ‘init_kbm’ at kbm.h:317:44:
hashset.h:95:21: warning: argument 1 value ‘10097331658659645683’ exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
  set->array       = calloc(set->size, set->e_size);                         \
                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
hashset.h:411:2: note: in expansion of macro ‘init_hashset_macro’
  init_hashset_macro(hash_type, hash_ele_type);                              \
  ^~~~~~~~~~~~~~~~~~
kbm.h:99:1: note: in expansion of macro ‘define_hashtable’
 define_hashtable(kbmhash, kbm_kmer_t, KBM_KMERCODE, KBM_KMEREQUALS, u8i, ITSELF, KBM_KEYEQUALS, kbm_kmer_t*, ITSELF);
 ^~~~~~~~~~~~~~~~
In file included from list.h:23,
                 from kbm.h:23,
                 from kbm.c:20:
kbm.h: In function ‘init_kbm’:
/usr/include/stdlib.h:541:14: note: in a call to allocation function ‘calloc’ declared here
 extern void *calloc (size_t __nmemb, size_t __size)
              ^~~~~~
...

I can't quite see my way through all the macros to figure out what it is referring to, but this sounds like it could be an issue.

gcc --version: gcc (Debian 8.3.0-6) 8.3.0 uname -rms: Linux 4.19.0-8-amd64 x86_64

ruanjue commented 4 years ago

I am using old version gcc. I guess this warning is caused by sys_prime_list, which contains a large value 0x8c20eda545b6c8f3LLU.