[Bug libstdc++/100376] __gnu_cxx::stdio_filebuf does not work correctly on windows for GCC 12

2022-12-26 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100376

Jonathan Wakely  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #4 from Jonathan Wakely  ---
User error

[Bug libstdc++/100376] __gnu_cxx::stdio_filebuf does not work correctly on windows for GCC 12

2021-05-01 Thread unlvsur at live dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100376

--- Comment #3 from cqwrteur  ---
i understand what's going on here.

It is because std::filebuf in libstdc++ has a __c_lock data member which is
before the __c_file. However, libstdc++ on windows does not support threading.
A lot of people including me was using GCC with MCF gthread. The
__gthread_lock_t in mcf gthread leads a different abi compared to nomarl
version of libstdc++.


The solution is that we need to provide win32 threading with libstdc++ by
ourselves with win32 apis. Or if people are using different threading
libraries, we get an ABI breaking.

[Bug libstdc++/100376] __gnu_cxx::stdio_filebuf does not work correctly on windows for GCC 12

2021-05-01 Thread unlvsur at live dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100376

--- Comment #2 from cqwrteur  ---
(In reply to cqwrteur from comment #1)
> What thing very wierd is that the code runs correctly under wine but
> incorrect on windows, even it is the same program.
> 
> D:\hg\fast_io\.tmp\vdso>g++ -o test test.cc -Ofast -std=c++20 -s -flto
> -march=native -I../../include
> 
> D:\hg\fast_io\.tmp\vdso>test
> 3
> 0
> 
> D:\hg\fast_io\.tmp\vdso>g++ -o test test.cc -Ofast -std=c++20 -s -flto
> -march=native -I../../include -static
> 
> D:\hg\fast_io\.tmp\vdso>
> D:\hg\fast_io\.tmp\vdso>test
> 3
> 3
> 
> It looks this is an issue with libstdc++.dll's abi?? maybe I missed
> something here?

Oh. i understand what is happening here. I installed too many versions of
libstdc++.dll, they conflict with each other.

Does windows have a version checker for dlls like Linux does?

[Bug libstdc++/100376] __gnu_cxx::stdio_filebuf does not work correctly on windows for GCC 12

2021-05-01 Thread unlvsur at live dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100376

--- Comment #1 from cqwrteur  ---
What thing very wierd is that the code runs correctly under wine but incorrect
on windows, even it is the same program.

D:\hg\fast_io\.tmp\vdso>g++ -o test test.cc -Ofast -std=c++20 -s -flto
-march=native -I../../include

D:\hg\fast_io\.tmp\vdso>test
3
0

D:\hg\fast_io\.tmp\vdso>g++ -o test test.cc -Ofast -std=c++20 -s -flto
-march=native -I../../include -static

D:\hg\fast_io\.tmp\vdso>
D:\hg\fast_io\.tmp\vdso>test
3
3

It looks this is an issue with libstdc++.dll's abi?? maybe I missed something
here?