https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65257
Bug ID: 65257 Summary: cin not working with empty string when _GLIBCXX_DEBUG is defined on Windows Product: gcc Version: 4.9.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: melnakeeb at hotmail dot com Using latest Cygwin32 ,Cygwin64 and MinGW32 with GCC 4.9.2 , 4.9.2 and 4.8.1 respectively on Windows 7 64-bit. I am testing also on 32-bit Linux using GCC 4.8.2. So on all systems this works #include <bits/stdc++.h> using namespace std; string s,t; int main(){ cin>>s>>t; cout<<s; } and this works #define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; string s="a",t="b"; int main(){ cin>>s>>t; cout<<s; } but the next one crashes on Windows after inputting the first string on the 3 configurations mentioned above, but works correctly on Linux: #define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; string s,t; int main(){ cin>>s>>t; cout<<s; } Clearly the only difference is that the string is empty before inputting, and _GLIBCXX_DEBUG is enabled. Previous discussions: http://stackoverflow.com/questions/28708802/cin-not-working-with-empty-string-when-glibcxx-debug-on-windows , http://sourceforge.net/p/mingw/bugs/1666/ and http://codeforces.com/blog/entry/15547#comment-215143