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.

Reply via email to