From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 701DB3858C39; Tue, 16 Jan 2024 08:05:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 701DB3858C39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1705392337; bh=N+tLy9v2lEEjFXn4qlaWQWy2Swez7OiWu/SBsBUmyCM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ehvt+PBMxktZpTF4RCspn8/PVv09+297beQGlP4TA5pLntMx2/jbHpMhlf5fsTi9v pP14YbvPH12+M7ZmRqXKS0XY/QSrDBiG/lMmzOpopHP38+Xnrf7uyRXJv7gVjFbQXZ s2aVziMT6XmUKtOHsylHxXQ6VGfCKdf3hoX62GW0= From: "buczek at molgen dot mpg.de" To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/113333] analyzer: False positives with calloc() Date: Tue, 16 Jan 2024 08:05:37 +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: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: buczek at molgen dot mpg.de X-Bugzilla-Status: ASSIGNED 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: 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=3D113333 --- Comment #4 from Donald Buczek --- Great, thank you! I wonder, if the related missed optimization opportunity should also be reported. #include int f(void) { char **vec =3D calloc(1, sizeof(char *)); if (vec) { // *vec =3D NULL; if (*vec) return 1; } return 0; } This resolves to nothing only if the commented-out line is added. https://gcc.godbolt.org/z/WTar6zdne Treat: clang gets it right.=