Re: Bug(?) of libstdc++ (COW is still used)
Takashi Yano via Cygwin <[email protected]>
| Newsgroups | gmane.os.cygwin |
|---|---|
| Message-ID | <[email protected]> |
On Sat, 15 Aug 2026 11:33:00 +0900
Takashi Yano wrote:
> Hi,
>
> I noticed that the libstdc++ on Cygwin still uses COW (copy-on-write),
> which is inhibited since C++11.
>
> The following code:
>
> #include <string>
> #include <cassert>
> #include <cstdio>
>
> int main()
> {
> std::string a("AAAA");
> std::string b;
> b = a;
>
> printf("%d\n", _GLIBCXX_USE_CXX11_ABI);
> printf("%p, %p: %s\n", a.c_str(), b.c_str(), b.c_str());
> b[0] = 'B';
> printf("%p, %p: %s\n", a.c_str(), b.c_str(), b.c_str());
>
> return 0;
> }
>
> outputs
>
> 0
> 0xa00000648, 0xa00000648: AAAA
> 0xa00000648, 0xa00000568: BAAA
>
> $ cygcheck -c libstdc++6
> Cygwin Package Information
> Package Version Status
> libstdc++6 14.4.0-1 OK
>
> Due to this, glslc in shaderc package sometimes crashes in libglslang.a
> because of Use-After-Free problem.
https://github.com/KhronosGroup/glslang/issues/4381
> Is there any reason that libstdc++ on Cygwin still uses COW
> (_GLIBCXX_USE_CXX11_ABI = 0 setting), even though it is inhibited
> since C++11?
--
Takashi Yano <[email protected]>
--
Problem reports: https://cygwin.com/problems.html
FAQ: https://cygwin.com/faq/
Documentation: https://cygwin.com/docs.html
Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple