I just ran that and updated my MSYS environment to the latest. Then copied the code in post #1 into main.cpp. Then:
Originally Posted by Codeplug
Same result if I compile and run outside of MSYS - runs to 99 every time.
$ g++ -Wall -O0 -g3 main.cpp -lpthread
$ a.exe | tail
Do you have any other versions of MinGW installed that aren't in C:\MinGW?
Your PATH environment variable should have "C:\MinGW\Bin" at the front of the PATH string.
You may need to uninstall anything with "MinGW" in it from control panel. Then delete C:\MinGW completely (plus any other MinGW installs). Then re-install.
Just checked my path, it's just C:\MinGW\bin (it's not at the front though).
I just reinstalled MinGW and eclipse, but it's still happening.
Since it didn't happen on your computer, and we're running the same versions of mingw, it makes me wonder, what could it be? The pthread lib comes with mingw, so they can't be different... I wonder, if we compare the outputs of the compiler, should they be identical?
I just tried running it outside of eclipse, and it worked! On top of that, if I Run from inside eclipse instead of Debug (which I've been doing) then it works. Perhaps I should have tried that sooner.
Does this mean it's a bug in GDB? Can someone else try running it in the debugger? If someone can reproduce it, then I can file a bug.