From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 473763858407; Tue, 17 May 2022 12:32:59 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 473763858407 From: "jochen447 at concept dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/105628] New: False positive with -Waddress Date: Tue, 17 May 2022 12:32:59 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 12.1.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jochen447 at concept dot de 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 May 2022 12:32:59 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105628 Bug ID: 105628 Summary: False positive with -Waddress Product: gcc Version: 12.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: jochen447 at concept dot de Target Milestone: --- Created attachment 52986 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D52986&action=3Dedit minified example program to show the false positive Option -Wall also enables -Waddress, which causes a lot of false positives = like shown in my attached example problem (minimized and anonymized real world example): waddress.c: In function =E2=80=98comp_has_ExtraPtr=E2=80=99: waddress.c:44:29: warning: the comparison will always evaluate as =E2=80=98= true=E2=80=99 for the pointer operand in =E2=80=98(struct Extra **)&comp->pin + 4=E2=80=99 mu= st not be NULL [-Waddress] 44 | return ExtraPtrOf(comp) ? 1 : 0; | ^ It only seems to be emitted when using the ?-operator. # gcc -v ... gcc version 12.1.1 20220507 (Red Hat 12.1.1-1) (GCC) # uname -a Linux fedora 5.17.6-300.fc36.x86_64 #1 SMP PREEMPT Mon May 9 15:47:11 UTC 2= 022 x86_64 x86_64 x86_64 GNU/Linux=