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

            Bug ID: 107793
           Summary: trivial-auto-var-init=pattern invalid uninitialized
                    variable warning
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: larsbj at gullik dot net
  Target Milestone: ---

Created attachment 53936
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53936&action=edit
Preprocessed source

This is most likely the same as Bug 107411, but with =pattern instead of =zero
and with GCC 12.2.1.

The preprocessed code has been reduced from production code with cvise.

g++ -v -Werror=uninitialized -Wno-return-type -std=gnu++20
-ftrivial-auto-var-init=pattern -c test.cpp.ii
Using built-in specs.
COLLECT_GCC=/usr/bin/g++
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,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 --enable-libstdcxx-backtrace
--with-linker-hash-style=gnu --enable-plugin --enable-initfini-array
--with-isl=/builddir/build/BUILD/gcc-12.2.1-20220819/obj-x86_64-redhat-linux/isl-install
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-offload-defaulted --enable-gnu-indirect-function --enable-cet
--with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
--with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.1 20220819 (Red Hat 12.2.1-2) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-Werror=uninitialized' '-Wno-return-type'
'-std=gnu++20' '-ftrivial-auto-var-init=pattern' '-c' '-o' 'test.cpp.o'
'-shared-libgcc' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-redhat-linux/12/cc1plus -fpreprocessed test.cpp.ii
-quiet -dumpbase test.cpp.ii -dumpbase-ext .ii -mtune=generic -march=x86-64
-Werror=uninitialized -Wno-return-type -std=gnu++20 -version
-ftrivial-auto-var-init=pattern -o /tmp/ccWKm8Nk.s
GNU C++20 (GCC) version 12.2.1 20220819 (Red Hat 12.2.1-2)
(x86_64-redhat-linux)
        compiled by GNU C version 12.2.1 20220819 (Red Hat 12.2.1-2), GMP
version 6.2.1, MPFR version 4.1.0-p13, MPC version 1.2.1, isl version
isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++20 (GCC) version 12.2.1 20220819 (Red Hat 12.2.1-2)
(x86_64-redhat-linux)
        compiled by GNU C version 12.2.1 20220819 (Red Hat 12.2.1-2), GMP
version 6.2.1, MPFR version 4.1.0-p13, MPC version 1.2.1, isl version
isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 9f5f4abeaa560d9a1c5632825fca686f
test.cpp.ii: In function ‘int make_arg(T) [with int <anonymous> = 0;
<template-parameter-1-2> = int; int <anonymous> = 0; T = int]’:
test.cpp.ii:16:15: error: ‘D.2668’ is used uninitialized
[-Werror=uninitialized]
   16 |   const auto &arg = arg_mapper().map(val);
      |               ^~~
cc1plus: some warnings being treated as errors

Reply via email to