]> git.ipfire.org Git - thirdparty/gcc.git/commit - libstdc++-v3/include/std/bitset
libstdc++: Fix misuse of alloca in std::bitset [PR108214]
authorJonathan Wakely <jwakely@redhat.com>
Fri, 6 Jan 2023 13:42:07 +0000 (13:42 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Fri, 6 Jan 2023 13:50:36 +0000 (13:50 +0000)
commit553332c19a04ad0a6bbdd2aafc3499a1cb4dfa0c
tree78f5d2e5504f4cf1d7d6e785441db772cb66ba56
parent8c330fd49464f3d47a7c171d767eb3a011add76b
libstdc++: Fix misuse of alloca in std::bitset [PR108214]

The use of alloca in a constructor is wrong, because the memory is gone
after the constructor returns, and will be overwritten by a subsequent
function call. This didn't show up in testing because function inlining
alters the stack usage.

libstdc++-v3/ChangeLog:

PR libstdc++/108214
* include/std/bitset (operator>>): Use alloca in the right
scope, not in a constructor.
* testsuite/20_util/bitset/io/input.cc: Check case from PR.
libstdc++-v3/include/std/bitset
libstdc++-v3/testsuite/20_util/bitset/io/input.cc