public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/86465] [8/9/10/11 Regression] C++17 <optional> triggers: ‘<anonymous>’ may be used uninitialized in this function
       [not found] <bug-86465-4@http.gcc.gnu.org/bugzilla/>
@ 2020-10-27 14:45 ` redi at gcc dot gnu.org
  2020-11-16 21:09 ` redi at gcc dot gnu.org
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2020-10-27 14:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Created attachment 49449
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49449&action=edit
preprocessed source, unreduced, gzipped

Here's another example that produces this kind of warning, this time from the
libstdc++ sources (when built with -Wsystem-headers -Werror)

It seems to be complaining about the std::allocator<char> object, which is an
empty class so (1) who cares if it's uninitialized and (2) it's not
uninitialized.

$ ~/gcc/11/bin/g++ -O2 -Wall cow-fs_path.ii -c      
In file included from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/string:55,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/stdexcept:38,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/system_error:40,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/fs_fwd.h:35,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/filesystem:43,
                 from
/home/jwakely/src/gcc/libstdc++-v3/src/c++17/fs_path.cc:34,
                 from
/home/jwakely/src/gcc/libstdc++-v3/src/c++17/cow-fs_path.cc:26:
In static member function ‘static _CharT* std::basic_string<_CharT, _Traits,
_Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&,
std::forward_iterator_tag) [with _FwdIterator = const char*; _CharT = char;
_Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’,
    inlined from ‘static _CharT* std::basic_string<_CharT, _Traits,
_Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&,
std::forward_iterator_tag) [with _FwdIterator = const char*; _CharT = char;
_Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ at
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:589:7,
    inlined from ‘static _CharT* std::basic_string<_CharT, _Traits,
_Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&) [with
_InIterator = const char*; _CharT = char; _Traits = std::char_traits<char>;
_Alloc = std::allocator<char>]’ at
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.h:5151:30,
    inlined from ‘std::basic_string<_CharT, _Traits,
_Alloc>::basic_string(const _CharT*, std::basic_string<_CharT, _Traits,
_Alloc>::size_type, const _Alloc&) [with _CharT = char; _Traits =
std::char_traits<char>; _Alloc = std::allocator<char>]’ at
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.h:3620:9,
    inlined from ‘std::basic_string<_CharT, _Traits,
_Alloc>::basic_string(std::basic_string<_CharT, _Traits, _Alloc>::__sv_wrapper,
const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc =
std::allocator<char>]’ at
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.h:3541:65,
    inlined from ‘std::basic_string<_CharT, _Traits,
_Alloc>::basic_string(const _Tp&, const _Alloc&) [with _Tp =
std::basic_string_view<char>; <template-parameter-2-2> = void; _CharT = char;
_Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ at
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.h:3731:58,
    inlined from ‘std::filesystem::path::path(const _Source&,
std::filesystem::path::format) [with _Source = std::basic_string_view<char>;
_Require = std::filesystem::path]’ at
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/fs_path.h:304:9,
    inlined from ‘void
std::filesystem::path::_M_concat(std::basic_string_view<char>)’ at
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/fs_path.h:340:24:
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:604:36:
warning: ‘<anonymous>’ may be used uninitialized [-Wmaybe-uninitialized]
  604 |         _Rep* __r = _Rep::_S_create(__dnew, size_type(0), __a);
      |                     ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/string:55,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/stdexcept:38,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/system_error:40,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/fs_fwd.h:35,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/filesystem:43,
                 from
/home/jwakely/src/gcc/libstdc++-v3/src/c++17/fs_path.cc:34,
                 from
/home/jwakely/src/gcc/libstdc++-v3/src/c++17/cow-fs_path.cc:26:
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:
In member function ‘void
std::filesystem::path::_M_concat(std::basic_string_view<char>)’:
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:980:5:
note: by argument 3 of type ‘const std::allocator<char>&’ to ‘static
std::basic_string<_CharT, _Traits, _Alloc>::_Rep* std::basic_string<_CharT,
_Traits, _Alloc>::_Rep::_S_create(std::basic_string<_CharT, _Traits,
_Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type,
const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc =
std::allocator<char>]’ declared here
  980 |     basic_string<_CharT, _Traits, _Alloc>::_Rep::
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/filesystem:44,
                 from
/home/jwakely/src/gcc/libstdc++-v3/src/c++17/fs_path.cc:34,
                 from
/home/jwakely/src/gcc/libstdc++-v3/src/c++17/cow-fs_path.cc:26:
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/fs_path.h:304:9:
note: ‘<anonymous>’ declared here
  304 |       : _M_pathname(_S_convert(__detail::__effective_range(__source)))
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/string:55,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/stdexcept:38,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/system_error:40,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/fs_fwd.h:35,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/filesystem:43,
                 from
/home/jwakely/src/gcc/libstdc++-v3/src/c++17/fs_path.cc:34,
                 from
/home/jwakely/src/gcc/libstdc++-v3/src/c++17/cow-fs_path.cc:26:
In static member function ‘static _CharT* std::basic_string<_CharT, _Traits,
_Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&,
std::forward_iterator_tag) [with _FwdIterator = const char*; _CharT = char;
_Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’,
    inlined from ‘static _CharT* std::basic_string<_CharT, _Traits,
_Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&,
std::forward_iterator_tag) [with _FwdIterator = const char*; _CharT = char;
_Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ at
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:589:7,
    inlined from ‘static _CharT* std::basic_string<_CharT, _Traits,
_Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&) [with
_InIterator = const char*; _CharT = char; _Traits = std::char_traits<char>;
_Alloc = std::allocator<char>]’ at
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.h:5151:30,
    inlined from ‘std::basic_string<_CharT, _Traits,
_Alloc>::basic_string(const _CharT*, std::basic_string<_CharT, _Traits,
_Alloc>::size_type, const _Alloc&) [with _CharT = char; _Traits =
std::char_traits<char>; _Alloc = std::allocator<char>]’ at
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.h:3620:9,
    inlined from ‘std::basic_string<_CharT, _Traits,
_Alloc>::basic_string(std::basic_string<_CharT, _Traits, _Alloc>::__sv_wrapper,
const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc =
std::allocator<char>]’ at
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.h:3541:65,
    inlined from ‘std::basic_string<_CharT, _Traits,
_Alloc>::basic_string(const _Tp&, const _Alloc&) [with _Tp =
std::basic_string_view<char>; <template-parameter-2-2> = void; _CharT = char;
_Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ at
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.h:3731:58,
    inlined from ‘std::filesystem::path::path(const _Source&,
std::filesystem::path::format) [with _Source = char [2]; _Require =
std::filesystem::path]’ at
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/fs_path.h:304:9,
    inlined from ‘std::filesystem::__detail::_Path<_Source>&
std::filesystem::path::operator=(const _Source&) [with _Source = char [2]]’ at
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/fs_path.h:340:24:
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:604:36:
warning: ‘<anonymous>’ may be used uninitialized [-Wmaybe-uninitialized]
  604 |         _Rep* __r = _Rep::_S_create(__dnew, size_type(0), __a);
      |                     ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/string:55,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/stdexcept:38,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/system_error:40,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/fs_fwd.h:35,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/filesystem:43,
                 from
/home/jwakely/src/gcc/libstdc++-v3/src/c++17/fs_path.cc:34,
                 from
/home/jwakely/src/gcc/libstdc++-v3/src/c++17/cow-fs_path.cc:26:
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:
In function ‘std::filesystem::__detail::_Path<_Source>&
std::filesystem::path::operator=(const _Source&) [with _Source = char [2]]’:
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:980:5:
note: by argument 3 of type ‘const std::allocator<char>&’ to ‘static
std::basic_string<_CharT, _Traits, _Alloc>::_Rep* std::basic_string<_CharT,
_Traits, _Alloc>::_Rep::_S_create(std::basic_string<_CharT, _Traits,
_Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type,
const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc =
std::allocator<char>]’ declared here
  980 |     basic_string<_CharT, _Traits, _Alloc>::_Rep::
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/filesystem:44,
                 from
/home/jwakely/src/gcc/libstdc++-v3/src/c++17/fs_path.cc:34,
                 from
/home/jwakely/src/gcc/libstdc++-v3/src/c++17/cow-fs_path.cc:26:
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/fs_path.h:304:9:
note: ‘<anonymous>’ declared here
  304 |       : _M_pathname(_S_convert(__detail::__effective_range(__source)))
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/string:55,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/stdexcept:38,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/system_error:40,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/fs_fwd.h:35,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/filesystem:43,
                 from
/home/jwakely/src/gcc/libstdc++-v3/src/c++17/fs_path.cc:34,
                 from
/home/jwakely/src/gcc/libstdc++-v3/src/c++17/cow-fs_path.cc:26:
In static member function ‘static _CharT* std::basic_string<_CharT, _Traits,
_Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&,
std::forward_iterator_tag) [with _FwdIterator = const char*; _CharT = char;
_Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’,
    inlined from ‘static _CharT* std::basic_string<_CharT, _Traits,
_Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&,
std::forward_iterator_tag) [with _FwdIterator = const char*; _CharT = char;
_Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ at
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:589:7,
    inlined from ‘static _CharT* std::basic_string<_CharT, _Traits,
_Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&) [with
_InIterator = const char*; _CharT = char; _Traits = std::char_traits<char>;
_Alloc = std::allocator<char>]’ at
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.h:5151:30,
    inlined from ‘std::basic_string<_CharT, _Traits,
_Alloc>::basic_string(const _CharT*, std::basic_string<_CharT, _Traits,
_Alloc>::size_type, const _Alloc&) [with _CharT = char; _Traits =
std::char_traits<char>; _Alloc = std::allocator<char>]’ at
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.h:3620:9,
    inlined from ‘std::basic_string<_CharT, _Traits,
_Alloc>::basic_string(std::basic_string<_CharT, _Traits, _Alloc>::__sv_wrapper,
const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc =
std::allocator<char>]’ at
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.h:3541:65,
    inlined from ‘std::basic_string<_CharT, _Traits,
_Alloc>::basic_string(const _Tp&, const _Alloc&) [with _Tp =
std::basic_string_view<char>; <template-parameter-2-2> = void; _CharT = char;
_Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’ at
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.h:3731:58,
    inlined from ‘std::filesystem::path::path(const _Source&,
std::filesystem::path::format) [with _Source = std::basic_string_view<char>;
_Require = std::filesystem::path]’ at
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/fs_path.h:304:9,
    inlined from ‘void
std::filesystem::path::_M_append(std::basic_string_view<char>)’ at
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/fs_path.h:340:24:
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:604:36:
warning: ‘<anonymous>’ may be used uninitialized [-Wmaybe-uninitialized]
  604 |         _Rep* __r = _Rep::_S_create(__dnew, size_type(0), __a);
      |                     ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/string:55,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/stdexcept:38,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/system_error:40,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/fs_fwd.h:35,
                 from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/filesystem:43,
                 from
/home/jwakely/src/gcc/libstdc++-v3/src/c++17/fs_path.cc:34,
                 from
/home/jwakely/src/gcc/libstdc++-v3/src/c++17/cow-fs_path.cc:26:
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:
In member function ‘void
std::filesystem::path::_M_append(std::basic_string_view<char>)’:
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:980:5:
note: by argument 3 of type ‘const std::allocator<char>&’ to ‘static
std::basic_string<_CharT, _Traits, _Alloc>::_Rep* std::basic_string<_CharT,
_Traits, _Alloc>::_Rep::_S_create(std::basic_string<_CharT, _Traits,
_Alloc>::size_type, std::basic_string<_CharT, _Traits, _Alloc>::size_type,
const _Alloc&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc =
std::allocator<char>]’ declared here
  980 |     basic_string<_CharT, _Traits, _Alloc>::_Rep::
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/filesystem:44,
                 from
/home/jwakely/src/gcc/libstdc++-v3/src/c++17/fs_path.cc:34,
                 from
/home/jwakely/src/gcc/libstdc++-v3/src/c++17/cow-fs_path.cc:26:
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/bits/fs_path.h:304:9:
note: ‘<anonymous>’ declared here
  304 |       : _M_pathname(_S_convert(__detail::__effective_range(__source)))
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

* [Bug c++/86465] [8/9/10/11 Regression] C++17 <optional> triggers: ‘<anonymous>’ may be used uninitialized in this function
       [not found] <bug-86465-4@http.gcc.gnu.org/bugzilla/>
  2020-10-27 14:45 ` [Bug c++/86465] [8/9/10/11 Regression] C++17 <optional> triggers: ‘<anonymous>’ may be used uninitialized in this function redi at gcc dot gnu.org
@ 2020-11-16 21:09 ` redi at gcc dot gnu.org
  2021-04-08 16:08 ` [Bug tree-optimization/86465] " jason at gcc dot gnu.org
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: redi at gcc dot gnu.org @ 2020-11-16 21:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #10)
> Created attachment 49449 [details]
> preprocessed source, unreduced, gzipped
> 
> Here's another example that produces this kind of warning, this time from
> the libstdc++ sources (when built with -Wsystem-headers -Werror)
> 
> It seems to be complaining about the std::allocator<char> object, which is
> an empty class so (1) who cares if it's uninitialized and (2) it's not
> uninitialized.

That one seems to be the same as PR 97840

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

* [Bug tree-optimization/86465] [8/9/10/11 Regression] C++17 <optional> triggers: ‘<anonymous>’ may be used uninitialized in this function
       [not found] <bug-86465-4@http.gcc.gnu.org/bugzilla/>
  2020-10-27 14:45 ` [Bug c++/86465] [8/9/10/11 Regression] C++17 <optional> triggers: ‘<anonymous>’ may be used uninitialized in this function redi at gcc dot gnu.org
  2020-11-16 21:09 ` redi at gcc dot gnu.org
@ 2021-04-08 16:08 ` jason at gcc dot gnu.org
  2021-05-14  9:50 ` [Bug tree-optimization/86465] [9/10/11/12 " jakub at gcc dot gnu.org
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: jason at gcc dot gnu.org @ 2021-04-08 16:08 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org
          Component|c++                         |tree-optimization

--- Comment #12 from Jason Merrill <jason at gcc dot gnu.org> ---
Changing component.

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

* [Bug tree-optimization/86465] [9/10/11/12 Regression] C++17 <optional> triggers: ‘<anonymous>’ may be used uninitialized in this function
       [not found] <bug-86465-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-04-08 16:08 ` [Bug tree-optimization/86465] " jason at gcc dot gnu.org
@ 2021-05-14  9:50 ` jakub at gcc dot gnu.org
  2021-06-01  8:11 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-14  9:50 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|8.5                         |9.4

--- Comment #13 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 8 branch is being closed.

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

* [Bug tree-optimization/86465] [9/10/11/12 Regression] C++17 <optional> triggers: ‘<anonymous>’ may be used uninitialized in this function
       [not found] <bug-86465-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2021-05-14  9:50 ` [Bug tree-optimization/86465] [9/10/11/12 " jakub at gcc dot gnu.org
@ 2021-06-01  8:11 ` rguenth at gcc dot gnu.org
  2022-01-12  9:59 ` geoff3jones at googlemail dot com
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01  8:11 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.4                         |9.5

--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.

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

* [Bug tree-optimization/86465] [9/10/11/12 Regression] C++17 <optional> triggers: ‘<anonymous>’ may be used uninitialized in this function
       [not found] <bug-86465-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2021-06-01  8:11 ` rguenth at gcc dot gnu.org
@ 2022-01-12  9:59 ` geoff3jones at googlemail dot com
  2022-01-12 10:16 ` geoff3jones at googlemail dot com
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: geoff3jones at googlemail dot com @ 2022-01-12  9:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from Geoff <geoff3jones at googlemail dot com> ---
This appears to still be an issue in gcc 11.2 minimal reproduced example using
std::optional https://godbolt.org/z/ebbMe3Wva


std::optional<bool> empty_optional(int x){
    return {};
}

std::optional<bool> empty_optional_or_true(int x){
    if(x > 0){
        return std::make_optional(true);
    }
    return {}; // <- second here
}

int main(){
empty_optional_or_true
}

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

* [Bug tree-optimization/86465] [9/10/11/12 Regression] C++17 <optional> triggers: ‘<anonymous>’ may be used uninitialized in this function
       [not found] <bug-86465-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2022-01-12  9:59 ` geoff3jones at googlemail dot com
@ 2022-01-12 10:16 ` geoff3jones at googlemail dot com
  2022-01-12 10:22 ` marc@nieper-wisskirchen.de
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: geoff3jones at googlemail dot com @ 2022-01-12 10:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Geoff <geoff3jones at googlemail dot com> ---
This appears to still be an issue in gcc 11.2 minimal reproduced example using
std::optional https://godbolt.org/z/ebbMe3Wva.

-std=c++17 -O3 -fsanitize=address -Wall -Werror -Wno-unused

std::optional<bool> empty_optional_or_true(int x){
    if(x > 0){
        return std::make_optional(true);
    }
    return {};
    //      ^ error here
}

int main(){
    empty_optional_or_true(0)
}

------------

In function 'std::optional<bool> empty_optional_or_true(int)',
    inlined from 'std::optional<bool> empty_optional_or_true(int)' at
<source>:28:21:
<source>:7:13: error: '*(unsigned char*)((char*)&<unnamed> +
offsetof(std::optional<bool>,std::optional<bool>::<unnamed>.std::_Optional_base<bool,
true, true>::<unnamed>))' may be used uninitialized
[-Werror=maybe-uninitialized]
    7 |     return {};
      |             ^
<source>: In function 'std::optional<bool> empty_optional_or_true(int)':
<source>:7:13: note: '<anonymous>' declared here
    7 |     return {}; // <- second here
      |    

In the linked example it can be see that making the global function static or
wrapping it in an anonymous namespace will cause the error to disappear.

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

* [Bug tree-optimization/86465] [9/10/11/12 Regression] C++17 <optional> triggers: ‘<anonymous>’ may be used uninitialized in this function
       [not found] <bug-86465-4@http.gcc.gnu.org/bugzilla/>
                   ` (6 preceding siblings ...)
  2022-01-12 10:16 ` geoff3jones at googlemail dot com
@ 2022-01-12 10:22 ` marc@nieper-wisskirchen.de
  2022-01-12 12:12 ` marc@nieper-wisskirchen.de
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: marc@nieper-wisskirchen.de @ 2022-01-12 10:22 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from Marc Nieper-Wißkirchen <marc@nieper-wisskirchen.de> ---
Does a viable workaround exist that doesn't amount to disabling the warning
option altogether?

In my case, the actual warning is triggered inside the standard library, which
is used by my code that uses std::optional.

Thanks.

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

* [Bug tree-optimization/86465] [9/10/11/12 Regression] C++17 <optional> triggers: ‘<anonymous>’ may be used uninitialized in this function
       [not found] <bug-86465-4@http.gcc.gnu.org/bugzilla/>
                   ` (7 preceding siblings ...)
  2022-01-12 10:22 ` marc@nieper-wisskirchen.de
@ 2022-01-12 12:12 ` marc@nieper-wisskirchen.de
  2022-05-27  9:39 ` [Bug tree-optimization/86465] [10/11/12/13 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 12+ messages in thread
From: marc@nieper-wisskirchen.de @ 2022-01-12 12:12 UTC (permalink / raw)
  To: gcc-bugs

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

Marc Nieper-Wißkirchen <marc@nieper-wisskirchen.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marc@nieper-wisskirchen.de

--- Comment #18 from Marc Nieper-Wißkirchen <marc@nieper-wisskirchen.de> ---
Does a viable workaround exist that doesn't amount to disabling the warning
option altogether?

In my case, the actual warning is triggered inside the standard library, which
is used by my code that uses std::optional.

Thanks.

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

* [Bug tree-optimization/86465] [10/11/12/13 Regression] C++17 <optional> triggers: ‘<anonymous>’ may be used uninitialized in this function
       [not found] <bug-86465-4@http.gcc.gnu.org/bugzilla/>
                   ` (8 preceding siblings ...)
  2022-01-12 12:12 ` marc@nieper-wisskirchen.de
@ 2022-05-27  9:39 ` rguenth at gcc dot gnu.org
  2022-06-28 10:35 ` jakub at gcc dot gnu.org
  2022-09-22 13:11 ` rguenth at gcc dot gnu.org
  11 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  9:39 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.5                         |10.4

--- Comment #19 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed

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

* [Bug tree-optimization/86465] [10/11/12/13 Regression] C++17 <optional> triggers: ‘<anonymous>’ may be used uninitialized in this function
       [not found] <bug-86465-4@http.gcc.gnu.org/bugzilla/>
                   ` (9 preceding siblings ...)
  2022-05-27  9:39 ` [Bug tree-optimization/86465] [10/11/12/13 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:35 ` jakub at gcc dot gnu.org
  2022-09-22 13:11 ` rguenth at gcc dot gnu.org
  11 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:35 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #20 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug tree-optimization/86465] [10/11/12/13 Regression] C++17 <optional> triggers: ‘<anonymous>’ may be used uninitialized in this function
       [not found] <bug-86465-4@http.gcc.gnu.org/bugzilla/>
                   ` (10 preceding siblings ...)
  2022-06-28 10:35 ` jakub at gcc dot gnu.org
@ 2022-09-22 13:11 ` rguenth at gcc dot gnu.org
  11 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-09-22 13:11 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #21 from Richard Biener <rguenth at gcc dot gnu.org> ---
The original, the heavy simplified and Jonathans example no longer reproduce
diagnostics for me on any active branch.  The latest reported issue still is
diagnosed with -fsanitize=address but that's a different issue.

So let's close this.

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

end of thread, other threads:[~2022-09-22 13:12 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-86465-4@http.gcc.gnu.org/bugzilla/>
2020-10-27 14:45 ` [Bug c++/86465] [8/9/10/11 Regression] C++17 <optional> triggers: ‘<anonymous>’ may be used uninitialized in this function redi at gcc dot gnu.org
2020-11-16 21:09 ` redi at gcc dot gnu.org
2021-04-08 16:08 ` [Bug tree-optimization/86465] " jason at gcc dot gnu.org
2021-05-14  9:50 ` [Bug tree-optimization/86465] [9/10/11/12 " jakub at gcc dot gnu.org
2021-06-01  8:11 ` rguenth at gcc dot gnu.org
2022-01-12  9:59 ` geoff3jones at googlemail dot com
2022-01-12 10:16 ` geoff3jones at googlemail dot com
2022-01-12 10:22 ` marc@nieper-wisskirchen.de
2022-01-12 12:12 ` marc@nieper-wisskirchen.de
2022-05-27  9:39 ` [Bug tree-optimization/86465] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:35 ` jakub at gcc dot gnu.org
2022-09-22 13:11 ` rguenth at gcc dot gnu.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).