From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CE6D4385734B; Fri, 26 May 2023 14:25:22 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CE6D4385734B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685111122; bh=/QjED73lyuX8eL8KAHkv2yc2zdNjdfhUZNj18rTJBIg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=JGjGOqeFkdejCCN2PAQ3Qz19bYHf5pXluycIaZk9lTfWKsXWT9qFf8Ufj2rLwWfb6 KPdFRPZF5whRq2R2seONvOMwkOlMZvxkxnL0gVjJRB7QA3cD99EJ09dH+Nuce0GMy0 U8js3sbe8oW/yqGqkvlEzZ+XZMaKwQrWFH5opkw8= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/109990] [12/13/14 Regression] Bogus -Wuse-after-free warning after realloc Date: Fri, 26 May 2023 14:25:22 +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: 13.1.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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=3D109990 --- Comment #1 from Andrew Pinski --- ``` char *new_pool =3D (char *) realloc (string_space, new_si= ze); if (new_pool =3D=3D ((void *)0)) goto out; if (__builtin_expect (string_space !=3D new_pool, 0)) { size_t i; for (i =3D 0; i < nmap; i++) { map[i].alias +=3D new_pool - string_space; map[i].value +=3D new_pool - string_space; } } string_space =3D new_pool; ``` Hmmm=