From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 136273858413; Sun, 28 Jan 2024 08:03:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 136273858413 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706428993; bh=G7FIgAalDIFXLQj53MBjNrUw+VYWYeNtM3kg+Cg8PZ8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=N3fdRgt8pOcfvoP0Xe+xGfymi6uKkzx3ZjcbMDJ46FsP5ITqM0zxaHjJF74HCPvV1 /J/EaPvZUw/4IZ4fIzdXkVlhzw6jCUWD/n9Gx3gN69PAdOVysUO/gMNrxGpLU5e9Rx Pc0OLfNyZ7OdmPwMv0dYbvOsU35Wb2mT5gg4QLwA= From: "nightstrike at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/110014] -Wanalyzer-allocation-size mishandles realloc (..., .... * sizeof (object)) Date: Sun, 28 Jan 2024 08:03:09 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: analyzer X-Bugzilla-Version: 13.1.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: nightstrike at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: dmalcolm at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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=3D110014 nightstrike changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nightstrike at gmail dot c= om --- Comment #3 from nightstrike --- (In reply to David Malcolm from comment #2) > Thanks for fixing this Tim. >=20 > Keeping open to track backporting this to the gcc 13 branch. Before this gets backported, the testcase should be fixed. It uses an incorrect declaration of realloc, assuming that size_t is long. The standa= rd defines realloc as size_t, so the declaration should use __SIZE_TYPE__ inst= ead. This works, although you could also just include stdlib.h or use __builtin_realloc.=