elfutils does not compile with gcc 12.2.0
Dmitry V. Levin
ldv@altlinux.org
Wed Aug 24 21:01:34 GMT 2022
On Wed, Aug 24, 2022 at 10:51:13PM +0200, Nick via Elfutils-devel wrote:
> I try to compile elfutils on OpenWrt with the newest gcc 12.2.0 version.
> However, it fails due to -Werror=use-after-free. A workaround is a patch
> that I found on the mailinglist, to disable -Werror
> (https://sourceware.org/legacy-ml/elfutils-devel/imported/msg00994.html)
> I modified it to apply to newest elfutils version. The error with
> elfutils 0.187 and gcc 12.2.0:
>
> In function 'bigger_buffer',
> inlined from '__libdw_gunzip' at gzip.c:376:12:
> gzip.c:98:9: error: pointer may be used after 'realloc'
> [-Werror=use-after-free]
> 98 | b = realloc (state->buffer, more -= 1024);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> gzip.c:96:13: note: call to 'realloc' here
> 96 | char *b = realloc (state->buffer, more);
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This warning is definitely wrong, looks like a regression in gcc, please
report this to compiler people, otherwise they will never know they
introduced a bug that needs fixing.
--
ldv
More information about the Elfutils-devel
mailing list