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.