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

            Bug ID: 126077
           Summary: Regression: basic_string<char>::<unnamed
                    union>::_M_allocated_capacity' may be used
                    uninitialized
           Product: gcc
           Version: 16.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: carel.combrink at gmail dot com
  Target Milestone: ---

Created attachment 64918
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=64918&action=edit
Source file to reproduce the issue

Upgrading existing code from gcc 12 to gcc 15 or 16 produces a new warning:
"std::__cxx11::basic_string<char>::_Alloc_hider::_M_p' may be used
uninitialized"

Code to reproduce the issue is attached and can be reproduced with the
following command line flags: `-O3 -DNDEBUG -std=c++23 -Wall -Wextra -Werror`

The code compiled without any warnings on GCC 12.5

The following compiler explorer link reproduces the issue:
https://godbolt.org/z/Gvqh88j1x

Changing to gcc 12.5 resolves the issue

Rewording the "description" field to "My description" (shorten it) will also
allow the code to build in gcc 15 and 16

Expectation: The code should compile as-is without warnings irrespective of the
length of the "description" field nor the newer compiler version.

Reply via email to