public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/108379] New: -Wmaybe-uninitialized false positive on conditional use
@ 2023-01-11 23:44 sam at gentoo dot org
  2023-01-11 23:45 ` [Bug tree-optimization/108379] " sam at gentoo dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: sam at gentoo dot org @ 2023-01-11 23:44 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108379
           Summary: -Wmaybe-uninitialized false positive on conditional
                    use
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sam at gentoo dot org
  Target Milestone: ---

Created attachment 54251
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54251&action=edit
tee.i

Occurs when applying a patch to coreutils on top of its git repo at
7fc84d1c0f6b35231b0b4577b70aaa26bf548a7c (attached for completeness):
```
gcc-13  -I. -I./lib  -Ilib -I./lib -Isrc -I./src  -Werror -fno-common -Wall
-Warith-conversion -Wbad-function-cast -Wcast-align=strict -Wdate-time
-Wdisabled-optimization -Wdouble-promotion -Wduplicated-branches
-Wduplicated-cond -Wextra -Wformat-signedness -Winit-self -Winvalid-pch
-Wlogical-op -Wmissing-declarations -Wmissing-include-dirs -Wmissing-prototypes
-Wnull-dereference -Wold-style-definition -Wopenmp-simd -Woverlength-strings
-Wpacked -Wpointer-arith -Wshadow -Wstrict-overflow -Wstrict-prototypes
-Wsuggest-attribute=cold -Wsuggest-attribute=const -Wsuggest-attribute=format
-Wsuggest-attribute=malloc -Wsuggest-attribute=noreturn
-Wsuggest-attribute=pure -Wsuggest-final-methods -Wsuggest-final-types
-Wsync-nand -Wtrampolines -Wuninitialized -Wunknown-pragmas -Wunused-macros
-Wvariadic-macros -Wvla -Wwrite-strings -Warray-bounds=2 -Wattribute-alias=2
-Wbidi-chars=any,ucn -Wformat=2 -Wimplicit-fallthrough=5 -Wshift-overflow=2
-Wuse-after-free=3 -Wunused-const-variable=2 -Wvla-larger-than=4031
-Wno-sign-compare -Wno-unused-parameter -Wno-format-nonliteral
-fdiagnostics-show-option -funit-at-a-time -Wno-return-local-addr -g -O2 -MT
src/tee.o -MD -MP -MF $depbase.Tpo -c -o src/tee.o src/tee.c &&\
mv -f $depbase.Tpo $depbase.Po
src/tee.c: In function 'tee_files':
src/tee.c:272:25: error: 'out_pollable' may be used uninitialized
[-Werror=maybe-uninitialized]
  272 |         out_pollable[i] = iopoll_output_ok (fileno (descriptors[i]));
      |         ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/tee.c:238:9: note: 'out_pollable' was declared here
  238 |   bool *out_pollable;
      |         ^~~~~~~~~~~~
cc1: all warnings being treated as errors
```

Reproduced with both GCC 12.2.1 20230107 and GCC 13.0.0 20230108.

Attached preprocessed source.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/108379] -Wmaybe-uninitialized false positive on conditional use
  2023-01-11 23:44 [Bug tree-optimization/108379] New: -Wmaybe-uninitialized false positive on conditional use sam at gentoo dot org
@ 2023-01-11 23:45 ` sam at gentoo dot org
  2023-01-11 23:47 ` sam at gentoo dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: sam at gentoo dot org @ 2023-01-11 23:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Sam James <sam at gentoo dot org> ---
Created attachment 54252
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54252&action=edit
coreutils-tee.patch

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/108379] -Wmaybe-uninitialized false positive on conditional use
  2023-01-11 23:44 [Bug tree-optimization/108379] New: -Wmaybe-uninitialized false positive on conditional use sam at gentoo dot org
  2023-01-11 23:45 ` [Bug tree-optimization/108379] " sam at gentoo dot org
@ 2023-01-11 23:47 ` sam at gentoo dot org
  2023-01-11 23:58 ` pinskia at gcc dot gnu.org
  2023-03-05 13:52 ` sam at gentoo dot org
  3 siblings, 0 replies; 5+ messages in thread
From: sam at gentoo dot org @ 2023-01-11 23:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Sam James <sam at gentoo dot org> ---
Minimum command needed to reproduce:
```
$ gcc-13 -Werror -Wuninitialized -O2 -c tee.i
src/tee.c: In function 'tee_files':
src/tee.c:272:25: error: 'out_pollable' may be used uninitialized
[-Werror=maybe-uninitialized]
src/tee.c:238:8: note: 'out_pollable' was declared here
cc1: all warnings being treated as errors
```

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/108379] -Wmaybe-uninitialized false positive on conditional use
  2023-01-11 23:44 [Bug tree-optimization/108379] New: -Wmaybe-uninitialized false positive on conditional use sam at gentoo dot org
  2023-01-11 23:45 ` [Bug tree-optimization/108379] " sam at gentoo dot org
  2023-01-11 23:47 ` sam at gentoo dot org
@ 2023-01-11 23:58 ` pinskia at gcc dot gnu.org
  2023-03-05 13:52 ` sam at gentoo dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-11 23:58 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I suspect since pipe_check is global is causing the unintialized warning
conditional checks to be thrown off because I suspect GCC thinks it can be
modified between the 3 checks of pipe_check when out_pollable is used.

So if you did a local copy of pipe_check to cache it inside tee_files and use
that, the warning will go away.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/108379] -Wmaybe-uninitialized false positive on conditional use
  2023-01-11 23:44 [Bug tree-optimization/108379] New: -Wmaybe-uninitialized false positive on conditional use sam at gentoo dot org
                   ` (2 preceding siblings ...)
  2023-01-11 23:58 ` pinskia at gcc dot gnu.org
@ 2023-03-05 13:52 ` sam at gentoo dot org
  3 siblings, 0 replies; 5+ messages in thread
From: sam at gentoo dot org @ 2023-03-05 13:52 UTC (permalink / raw)
  To: gcc-bugs

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

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eggert at cs dot ucla.edu

--- Comment #4 from Sam James <sam at gentoo dot org> ---
tee -P is now in coreutils git. Paul's applied
https://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=0789451237b90324a5d1f5c1b9fbaa5099f4c072
as a workaround to avoid this warning.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-05 13:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-11 23:44 [Bug tree-optimization/108379] New: -Wmaybe-uninitialized false positive on conditional use sam at gentoo dot org
2023-01-11 23:45 ` [Bug tree-optimization/108379] " sam at gentoo dot org
2023-01-11 23:47 ` sam at gentoo dot org
2023-01-11 23:58 ` pinskia at gcc dot gnu.org
2023-03-05 13:52 ` sam at gentoo dot org

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).