public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "eggert at cs dot ucla.edu" <gcc-bugzilla@gcc.gnu.org> 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 [thread overview] Message-ID: <bug-104060-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104060 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=52209&action=edit compile with 'gcc -Wuninitialized' to see the false alarm I ran into this problem when compiling an experimental version of GNU coreutils 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 have 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 dereferenced). false-alarm-uninit.c: In function ‘digest_check’: false-alarm-uninit.c:13:31: warning: ‘bin_buffer_unaligned’ may be used uninitialized [-Wmaybe-uninitialized] 13 | unsigned char *bin_buffer = ptr_align (bin_buffer_unaligned, 1024); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ false-alarm-uninit.c:2:1: note: by argument 1 of type ‘const void *’ to ‘ptr_align’ declared here 2 | ptr_align (void const *ptr, unsigned long alignment) | ^~~~~~~~~ false-alarm-uninit.c:12:17: note: ‘bin_buffer_unaligned’ declared here 12 | unsigned char bin_buffer_unaligned[10000]; | ^~~~~~~~~~~~~~~~~~~~
next reply other threads:[~2022-01-17 3:41 UTC|newest] Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-01-17 3:41 eggert at cs dot ucla.edu [this message] 2022-01-17 3:49 ` [Bug tree-optimization/104060] [11/12 Regression] " pinskia at gcc dot gnu.org 2022-01-17 8:45 ` rguenth at gcc dot gnu.org 2022-04-21 7:51 ` rguenth at gcc dot gnu.org 2023-05-29 10:06 ` [Bug tree-optimization/104060] [11/12/13/14 " jakub at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-104060-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).