Open balducci opened 2 years ago
for completeness: I see the same problem (still exposed only by gcc-12.1.0) with belle-sip:
/home/balducci/tmp/install-us-d/linphone-15734.d/linphone-15734/belle-sip/src/transports/tls_channel.c: In function 'belle_sip_generate_self_signed_certificate':
/home/balducci/tmp/install-us-d/linphone-15734.d/linphone-15734/belle-sip/include/belle-sip/utils.h:39:24: error: pointer 'name_with_path' used after 'free' [-Werror=use-after-free]
39 | #define belle_sip_free bctbx_free
/home/balducci/tmp/install-us-d/linphone-15734.d/linphone-15734/belle-sip/src/transports/tls_channel.c:288:25: note: in expansion of macro 'belle_sip_free'
288 | belle_sip_free(name_with_path);
| ^~~~~~~~~~~~~~
/home/balducci/tmp/install-us-d/linphone-15734.d/linphone-15734/belle-sip/src/transports/tls_channel.c:283:25: note: call to 'free' here
283 | free(name_with_path);
| ^~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
the same ^ :(
/home/user/aur/bctoolbox/src/utils/port.c: In function ‘bctbx_concat’: /home/user/aur/bctoolbox/src/utils/port.c:1677:49: error: pointer ‘result’ may be used after ‘realloc’ [-Werror=use-after-free] 1677 | wp = newp + (wp - result); | ~~~~^~~~~~~~~ /home/user/aur/bctoolbox/src/utils/port.c:1671:49: note: call to ‘realloc’ here 1671 | newp = (char *) realloc (result, allocated); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[2]: *** [src/CMakeFiles/bctoolbox-static.dir/build.make:118: src/CMakeFiles/bctoolbox-static.dir/utils/port.c.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:140: src/CMakeFiles/bctoolbox-static.dir/all] Error 2 make: *** [Makefile:136: all] Error 2
dump:
[user@archlinux bctoolbox]$ cmake -DCMAKE_SKIP_INSTALL_RPATH=ON CMake Warning: No source or binary directory provided. Both will be assumed to be the same as the current working directory, but note that this warning will become a fatal error in future CMake releases.
-- Setting install rpath to /usr/local/lib -- MBEDTLS Enabled -- MBEDTLS Enabled search enabled -- Using mbedTLS -- Using Decaf -- DTLS SRTP not available -- Configuring done -- Generating done -- Build files have been written to: /home/user/aur/bctoolbox
hello latest gcc-12.1.0 (just released) exposes a (possible) problem with bctoolbox (master, e2fa63767fb5b920e017e72516c787cadec9f515):
gcc<12 doesn't report any problem (I have verified with
gcc-11.3.0
, but I'm building linphone since a lot of time and never saw this)I can work around with
-Wno-error=use-after-free
(as suggested) but I thought you might be interested in thisBuilding bctoolbox on linux:
Linux 5.17.3 #1 SMP Thu Apr 14 10:09:58 CEST 2022 x86_64 GNU/Linux
with default options.
gcc version:
thank you very much for your valuable work ciao -gabriele