CLANG18 compiler warning with -O3: -Walloc-size-larger-than in ivas_vbap_fx.c
Basic info
- Fixed point: d3508f9d
Bug description
Compiling the BASOP code with CLANG18 and optimization level 3, there is this warning issued:
In file included from lib_basop/stl.h:63,
from lib_com/cnst.h:42,
from lib_com/prot_fx.h:48,
from lib_rend/ivas_vbap_fx.c:36:
lib_rend/ivas_vbap_fx.c:366:69: warning: argument 1 value '18446744073709551440' exceeds maximum object size 9223372036854775807 [-Walloc-size-larger-than=]
366 | IF( ( vbap->search_struct[0].triplets = (VBAP_VS_TRIPLET *) malloc( ( ( speaker_nodes_group1_internal - 2 ) * 2 - ( s_max( 0, ( speaker_nodes_horiz_internal - 2 ) ) ) ) * sizeof( VBAP_VS_TRIPLET ) ) ) == NULL )
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from lib_com/prot_fx.h:44,
from lib_rend/ivas_vbap_fx.c:36:
/usr/include/stdlib.h:672:14: note: in a call to allocation function 'malloc' declared here
672 | extern void *malloc (size_t __size) __THROW __attribute_malloc__
| ^~~~~~
I am unsure how to interpret this exactly, but it looks scary
Ways to reproduce
set CC to clang and OPTIM to 3 in Makefile, then
make