https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85233
Bug ID: 85233 Summary: Incorrect -Wmaybe-uninitialized with -fpartial-inlining -finline-small-functions Product: gcc Version: 7.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: erik.carstensen at intel dot com Target Milestone: --- Created attachment 43858 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=43858&action=edit Reproducer When compiling the attachment with gcc -Wall -c foo.c -o foo.o -O1 -fpartial-inlining -finline-small-functions I get the warning: foo.c:26:11: warning: ‘x’ may be used uninitialized in this function [-Wmaybe-uninitialized] c = x; though it can be easily proven that x is not used uninitialized. I tried this with 7.3.1 from fedora 27, $ gcc -v COLLECT_GCC=/usr/bin/gcc COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/7/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-redhat-linux Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,objc,obj-c++,fortran,ada,go,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --enable-libmpx --enable-offload-targets=nvptx-none --without-cuda-driver --enable-gnu-indirect-function --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 7.3.1 20180303 (Red Hat 7.3.1-5) (GCC) I also tried some other gcc versions I had lying around. I can reproduce it in all versions I have that support -fpartial-inlining (down to gcc 5.2.0) While minimizing the test case I could see that the warning only seems to happen when f is partially inlined, so a workaround is to pass -fno-partial-inlining for affected files.