From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2B63F3858C60; Fri, 24 Mar 2023 18:46:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2B63F3858C60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679683610; bh=QAnGSb+oUor8WGWxWYK8PjzGJUbaMco2aWObyATPnMI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=K/h2UPUt2lAih3TqPhgcqJmYWPCMQ1iNHWjGS/XA4nQf5KrRWl1htGiKZZb5xJ/gZ CY52UiVWkQ/Yp0s5/mMNMM3uvm1tmunuxQx6+wftF55W+4GNhuUbbZZFWkivxRcZK4 8by0DHLaFQJLnjADLGgxPEol9o4D+9HWM4JCWypw= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109175] error: 'void* __builtin_memset(void*, int, long unsigned int)' writing 4 or more bytes into a region of size 0 overflows the destination [-Werror=stringop-overflow=] Date: Fri, 24 Mar 2023 18:46:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: diagnostic, needs-reduction 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=3D109175 --- Comment #6 from Andrew Pinski --- Reduced all the way removing all of the classes showing exactly what I thou= ght it was: ``` void *ao(); float *aq(long t) { if (t) return nullptr; return static_cast(ao()); } float v; void at(long t) { long a =3D sizeof(0), i =3D 0; auto b =3D aq(t); for (; i < a; ++i) b[i] =3D v; for (; i < t; ++i) b[i] =3D 0.0f; } ``` Notice how there is no check for null on aq.=