From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 970333858415; Mon, 17 Jan 2022 03:41:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 970333858415 From: "eggert at cs dot ucla.edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/104060] New: -Wmaybe-uninitialized false alarm on address of local array Date: Mon, 17 Jan 2022 03:41:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 11.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: eggert at cs dot ucla.edu 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: Mon, 17 Jan 2022 03:41:47 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104060 Bug ID: 104060 Summary: -Wmaybe-uninitialized false alarm on address of local array Product: gcc Version: 11.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: eggert at cs dot ucla.edu Target Milestone: --- Created attachment 52209 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D52209&action=3Dedit compile with 'gcc -Wuninitialized' to see the false alarm I ran into this problem when compiling an experimental version of GNU coreu= tils with gcc 11.2.1 20211203 (Red Hat 11.2.1-7), x86-64. This is a regression, since gcc 8.5.0 20210514 (Red Hat 8.5.0-4) does not h= ave the problem. Compile the attached program with 'gcc -Wuninitialized -S false-alarm-uninit.c'. There should be no output, but GCC outputs the following. The diagnostic is incorrect, as bin_buffer_unaligned is an array that is never read from or written to. Apparently GCC is getting confused because the array's address is taken (but that address is never dereference= d). false-alarm-uninit.c: In function =E2=80=98digest_check=E2=80=99: false-alarm-uninit.c:13:31: warning: =E2=80=98bin_buffer_unaligned=E2=80=99= may be used uninitialized [-Wmaybe-uninitialized] 13 | unsigned char *bin_buffer =3D ptr_align (bin_buffer_unaligned, 10= 24); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ false-alarm-uninit.c:2:1: note: by argument 1 of type =E2=80=98const void *= =E2=80=99 to =E2=80=98ptr_align=E2=80=99 declared here 2 | ptr_align (void const *ptr, unsigned long alignment) | ^~~~~~~~~ false-alarm-uninit.c:12:17: note: =E2=80=98bin_buffer_unaligned=E2=80=99 de= clared here 12 | unsigned char bin_buffer_unaligned[10000]; | ^~~~~~~~~~~~~~~~~~~~=