sergey-safarov created an issue (kamailio/kamailio#4484)
``` /root/rpmbuild/BUILD/kamailio-6.1.0-dev1/src/modules/ims_qos_npn/rx_aar.c:671:69: warning: ‘rpl_sdp_session’ may be used uninitialized [-Wmaybe-uninitialized] 671 | ipB = rpl_sdp_session->ip_addr; | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ /root/rpmbuild/BUILD/kamailio-6.1.0-dev1/src/modules/ims_qos_npn/rx_aar.c:560:47: note: ‘rpl_sdp_session’ was declared here 560 | sdp_session_cell_t *req_sdp_session, *rpl_sdp_session; | ^~~~~~~~~~~~~~~ /root/rpmbuild/BUILD/kamailio-6.1.0-dev1/src/modules/ims_qos_npn/rx_aar.c:620:35: warning: ‘rpl_sdp_stream’ may be used uninitialized [-Wmaybe-uninitialized] 620 | if(rpl_sdp_stream) { | ^ /root/rpmbuild/BUILD/kamailio-6.1.0-dev1/src/modules/ims_qos_npn/rx_aar.c:561:45: note: ‘rpl_sdp_stream’ was declared here 561 | sdp_stream_cell_t *req_sdp_stream, *rpl_sdp_stream; | ^~~~~~~~~~~~~~ ```
xkaraman left a comment (kamailio/kamailio#4484)
Hey @sergey-safarov,
What are you compiler options that resulted in this warning?
I tried to replicated this on `Alpine Linux v3.22` with gcc `gcc version 14.2.0` but i could not replicate this warning.
Steps i used was: 1. Provide addiotional compile flags to compiler to be more verbose on config step:
`CFLAGS='-Wall -Wmaybe-uninitialized' cmake -S . -B build-alpine-redis -DINCLUDE_MODULES="ims_qos_npn" -DCMAKE_INSTALL_PREFIX=install/alpine-redis --fresh`
2. Try to build with verbose mode to see the flags:
`cmake --build build-alpine-redis/ -j8 -t ims_qos_npn -v`
result in:
``` c cd /code/build-alpine-redis/src/modules/ims_qos_npn && /usr/bin/cc -DADAPTIVE_WAIT -DADAPTIVE_WAIT_LOOPS=1024 - \DARCH="x86_64" -DCC_GCC_LIKE_ASM -DCFG_DIR="/code/install/alpine-redis/etc/kamailio/" -DCOMPILER=""gcc 14.2.0"" -DDBG_SR_MEMORY -DDISABLE_NAGLE -DDNS_IP_HACK -DFAST_LOCK -DF_MALLOC -DHAVE_ALLOCA_H -DHAVE_EPOLL -DHAVE_GETHOSTBYNAME2 -DHAVE_IP_MREQN -DHAVE_MSGHDR_MSG_CONTROL -DHAVE_MSG_NOSIGNAL -DHAVE_RESOLV_RES -DHAVE_SCHED_SETSCHEDULER -DHAVE_SCHED_YIELD -DHAVE_SELECT -DHAVE_SIGIO_RT -DHAVE_TIMEGM -DHAVE_UNION_SEMUN -DKSR_PTHREAD_MUTEX_SHARED -DMALLOC_STATS -DMEM_JOIN_FREE -DMOD_NAME="ims_qos_npn" -DMOD_NAMEID=ims_qos_npn -DNAME="kamailio" -DOS=Linux -DOS_QUOTED="Linux" -DPKG_MALLOC -DQ_MALLOC -DRUN_DIR="/run/kamailio" -DSHARE_DIR="/code/install/alpine-redis/share/kamailio/" -DSHM_MMAP -DSIGINFO64_WORKAROUND -DSTATISTICS -DTLSF_MALLOC -DTLS_HOOKS -DUSE_CORE_STATS -DUSE_DNS_CACHE -DUSE_DNS_FAILOVER -DUSE_DST_BLOCKLIST -DUSE_FUTEX -DUSE_MCAST -DUSE_NAPTR -DUSE_RAW_SOCKS -DUSE_SCTP -DUSE_TCP -DUSE_TLS -DVERSION="6.1.0-dev1" -DVERSIONVAL=6001000 -D__CPU_x86_64 -D__OS_linux \ -Dims_qos_npn_EXPORTS \ **-Wall -Wmaybe-uninitialized** -g -std=gnu11 -fPIC -ffile-prefix-map=/code/src/modules/ims_qos_npn/= -fPIC -funroll-loops -Wcast-align -m64 -minline-all-stringops -falign-loops -ftree-vectorize -fno-strict-overflow -mtune=generic -MD -MT src/modules/ims_qos_npn/CMakeFiles/ims_qos_npn.dir/rx_aar.c.o -MF CMakeFiles/ims_qos_npn.dir/rx_aar.c.o.d -o CMakeFiles/ims_qos_npn.dir/rx_aar.c.o -c /code/src/modules/ims_qos_npn/rx_aar.c ```
`-Wall` and `-Wmaybe-uninitialized` are present.
But there is no warning about uninitialized variables on my side.
I also tried this on Ubuntu with `gcc version 10.5.0 (Ubuntu 10.5.0-1ubuntu1~20.04)`, with the same results
xkaraman left a comment (kamailio/kamailio#4484)
Assuming you where using the same extra compile option as found in https://github.com/kamailio/kamailio/issues/4439
`-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v3 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -DNDEBUG`.
i still can;t see these errors for `ims_qos_npn`
Closed #4484 as completed.
miconda left a comment (kamailio/kamailio#4484)
Closing it, some commit was pushed, but if something new shows up, a new item can be created.