From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D6CB6385558D; Fri, 12 May 2023 13:20:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D6CB6385558D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1683897626; bh=uMcGY7HcNxwK1wRwcwwz6jyG4Y4ZC+iYeNcq1IA3d7Y=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ZkyyxN4gwMCtUYHjcIk+8EXUm35k3dnNnSSw4hvgoW2swO40XVAtIIyzkSM2zZFxX VAdqHS7hdIHx6HdJan4wZsZS0Am81FmPoa4aRsoSbDM77HS0TnpbA1/U8FXCfrrDmS O32UIff/Lu3b53zQAdp/mLMWZurcS92RiQWLSp5E= From: "mkaracsony81 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/104069] Wuse-after-free=2 -O0 false positive "may be used" Date: Fri, 12 May 2023 13:20:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: mkaracsony81 at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104069 --- Comment #31 from Miklos Karacsony --- (In reply to Sergei Trofimovich from comment #30) > > configure: WARNING: unrecognized options: --disable-werror > > In function 'bigger_buffer', > > inlined from '__libdw_gunzip' at gzip.c:374:12: > > gzip.c:96:9: error: pointer may be used after 'realloc' > > [-Werror=3Duse-after-free] > > 96 | b =3D realloc (state->buffer, more -=3D 1024); > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > gzip.c:94:13: note: call to 'realloc' here > > 94 | char *b =3D realloc (state->buffer, more); > > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > cc1: all warnings being treated as errors > > make[2]: *** [Makefile:715: gzip.o] Error 1 >=20 > You should be able to extract preprocessed file using > https://gcc.gnu.org/bugs/#need: you will need to find exact `gcc` invocat= ion > that causes build failure, add `-save-temps` parameter to it, grab '*.i' > file and attach it along with exact command you used to produce it. That gcc page does not say how to extract the command from the makefile that triggers the error, so I've tried to reproduce this bug manually and after = like the 8th attempt when all the header files were finally found by the compile= r, the linker errored out with some undefined references, so no luck. The good= new is that this error is reproducible if the cflags/ldflags/configure...etc switches set up like in c#29=