public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: elfutils-devel@sourceware.org
Subject: Re: elfutils does not compile with gcc 12.2.0
Date: Thu, 25 Aug 2022 00:01:34 +0300	[thread overview]
Message-ID: <20220824210134.GA1005@altlinux.org> (raw)
In-Reply-To: <340e1f2d-ffd6-6b28-aa5e-3d3f3a535f07@systemli.org>

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


  reply	other threads:[~2022-08-24 21:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-24 20:51 Nick
2022-08-24 21:01 ` Dmitry V. Levin [this message]
2022-08-25  8:51   ` Nick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220824210134.GA1005@altlinux.org \
    --to=ldv@altlinux.org \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).