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

            Bug ID: 116212
           Summary: [13/14/15 regression] -Walloc-size-larger-than warning
                    when building
                    20_util/specialized_algorithms/uninitialized_move/cons
                    trained.cc with -O3
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sjames at gcc dot gnu.org
  Target Milestone: ---

Created attachment 58810
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58810&action=edit
a-constrained.ii.xz

```
$ g++ -I /home/sam/git/gcc/libstdc++-v3/testsuite/util/ constrained.cc
-std=c++20 -O3
constrained.cc: In function ‘void test01(std::vector<T>) [with T = char]’:
constrained.cc:54:45: warning: argument 1 range [18446744071562067968,
18446744073709551615] exceeds maximum object size 9223372036854775807
[-Walloc-size-larger-than=]
   54 |       auto buffer = std::unique_ptr<char[]>(new char[sizeof(T)*size]);
      |                                             ^~~~~~~~~~~~~~~~~~~~~~~~
In file included from
/usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/stl_iterator.h:75,
                 from
/usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/bits/stl_algobase.h:67,
                 from
/usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/algorithm:60,
                 from constrained.cc:19:
/usr/lib/gcc/x86_64-pc-linux-gnu/15/include/g++-v15/new:133:26: note: in a call
to allocation function ‘void* operator new [](std::size_t)’ declared here
  133 | _GLIBCXX_NODISCARD void* operator new[](std::size_t) _GLIBCXX_THROW
(std::bad_alloc)
      |                          ^~~~~~~~
```

Reply via email to