public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/104550] bogus warning from -Wuninitialized + -ftrivial-auto-var-init=pattern
Date: Mon, 21 Feb 2022 07:56:30 +0000	[thread overview]
Message-ID: <bug-104550-4-nwQgogxjGr@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104550-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104550

--- Comment #19 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to qinzhao from comment #18)
> One question here, for the following testing case:
> 
> [opc@qinzhao-ol7u9 104550]$ cat t1.c
> struct vx_audio_level {
>  int has_monitor_level : 1;
> };
> 
> void vx_set_monitor_level() {
>  struct vx_audio_level info;
>  __builtin_clear_padding (&info);
> }
> [opc@qinzhao-ol7u9 104550]$ sh t
> /home/opc/Install/latest/bin/gcc -O -Wuninitialized -Wall t1.c -S
> t1.c: In function ‘vx_set_monitor_level’:
> t1.c:7:2: warning: ‘info’ is used uninitialized [-Wuninitialized]
>     7 |  __builtin_clear_padding (&info);
>       |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> t1.c:6:24: note: ‘info’ declared here
>     6 |  struct vx_audio_level info;
>       |                        ^~~~
> 
> We can see that the compiler emitted the exactly same warning as with
> -ftrivial-auto-var-init=pattern. 
> 
> my question is, is the "info" in __builtin_clear_padding(&info) a REAL use
> of "info"? is it correct to report the uninitialized use message for it?

As said I think reads emitted from __builtin_clear_padding lowering should
not be considered for (uninit) diagnostics.

  parent reply	other threads:[~2022-02-21  7:56 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15 15:49 [Bug middle-end/104550] New: " qinzhao at gcc dot gnu.org
2022-02-15 15:50 ` [Bug middle-end/104550] " qinzhao at gcc dot gnu.org
2022-02-15 15:52 ` qinzhao at gcc dot gnu.org
2022-02-15 21:33 ` qinzhao at gcc dot gnu.org
2022-02-15 21:38 ` pinskia at gcc dot gnu.org
2022-02-15 22:38 ` qing.zhao at oracle dot com
2022-02-16 10:33 ` rguenther at suse dot de
2022-02-16 15:05 ` qinzhao at gcc dot gnu.org
2022-02-16 15:38 ` jakub at gcc dot gnu.org
2022-02-16 16:24 ` qinzhao at gcc dot gnu.org
2022-02-16 16:44 ` jakub at gcc dot gnu.org
2022-02-16 16:57 ` qinzhao at gcc dot gnu.org
2022-02-17  7:54 ` rguenther at suse dot de
2022-02-17  8:01 ` rguenther at suse dot de
2022-02-17 16:47 ` qing.zhao at oracle dot com
2022-02-17 16:53 ` jakub at gcc dot gnu.org
2022-02-18  6:53 ` rguenther at suse dot de
2022-02-18 17:16 ` qinzhao at gcc dot gnu.org
2022-02-18 20:14 ` qinzhao at gcc dot gnu.org
2022-02-21  7:56 ` rguenth at gcc dot gnu.org [this message]
2022-02-21 15:21 ` qing.zhao at oracle dot com
2022-02-28 15:58 ` cvs-commit at gcc dot gnu.org
2022-02-28 16:00 ` qinzhao 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-104550-4-nwQgogxjGr@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: link
Be 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).