From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E743B3858D35; Sun, 19 Mar 2023 08:57:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E743B3858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679216260; bh=Gxm4rrDuIzz1sdKk1uSDyE3EsZUj2rOCMaWcrQP89R0=; h=From:To:Subject:Date:From; b=tLY9S3SMjEPI5fZgWs5Alq9mRDgOIo6zwqu9DpPOOCZB41PiLchdyr5bZ0I4bbzuY ox+psIDHS380KthmgJtu+Cxq6Fxkpw5dR5/lHR9xCVErEksRHSpdfIUBmjtpE/NAqo ggyJhZjObvF+AZBZDEdvFpjK/cXue6E8rPhV2CpA= From: "geoffreydgr at icloud dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/109190] New: GCC Static Analyzer cannot handle the initialization of an array with a for loop Date: Sun, 19 Mar 2023 08:57:40 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: analyzer X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: geoffreydgr at icloud 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D109190 Bug ID: 109190 Summary: GCC Static Analyzer cannot handle the initialization of an array with a for loop Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: geoffreydgr at icloud dot com Target Milestone: --- I got a false negative error when compiling the following program with gcc(trunk) -fanalyzer -O0 in https://godbolt.org/z/KvoxvPq5c. When I replace the array `m` with the variable `a` (https://godbolt.org/z/jTzo9bEo9), the = NPD appears. ```c #include "stdio.h" int main() { int i =3D 0; int *g =3D &i; int m[1]; for (int j =3D 0; j < 1; j++) { m[j] =3D 0; } if (m[0]) ; else g =3D m[i]; printf("NPD_FLAG\n"); *g =3D 1; } ```=