Fail when accessing std::xxx under clang++

I previously posted this same question here:
http://stackoverflow.com/questions/24242329/fail-when-accessing-stdxxx-under-clang
<http://stackoverflow.com/questions/24242329/fail-when-accessing-stdxxx-under-clang>

But no one answered so I am re-posting it here. Hopefully no one is
offended.

I am using clang 3.4.1 running under windows and mingw32 (gcc 4.8.1).

I have no problem with compiling C program under clang and running it. I
also have no problem compiling C++ program through clang++. But I have
problem running the resulting C++ program. It failed with an error stating
that the program has halted. I am pretty sure that it has got something to
do with the std:: as it failed whenever I invoked any functions in the std.

Here is my simple C++ program:

  #include <iostream>
  int main() {
    std::cout << "hello, world!" << std::endl;
    return 0;
  }

I compiled with this command:

  clang++ Hello.cc -o Hello.exe

Any advice?

edit: I discovered that if I *std::cout << "hello, world!\n"*, it terminated
gracefully. But *std::cout << "count: " << count* produced the same error.

I previously posted this same question here:

http://stackoverflow.com/questions/24242329/fail-when-accessing-stdxxx-under-clang
<
http://stackoverflow.com/questions/24242329/fail-when-accessing-stdxxx-under-clang
>

But no one answered so I am re-posting it here. Hopefully no one is
offended.

I am using clang 3.4.1 running under windows and mingw32 (gcc 4.8.1).

I have no problem with compiling C program under clang and running it. I
also have no problem compiling C++ program through clang++. But I have
problem running the resulting C++ program. It failed with an error stating
that the program has halted. I am pretty sure that it has got something to
do with the std:: as it failed whenever I invoked any functions in the std.

Here is my simple C++ program:

  #include <iostream>
  int main() {
    std::cout << "hello, world!" << std::endl;
    return 0;
  }

I compiled with this command:

  clang++ Hello.cc -o Hello.exe

Any advice?

Try running it under a debugger and see where it fails, and try to figure
out why it's failing.

Apparently, it failed in libstdc++-6.dll. Unfortunately, I have no source
code.

6FC59018 push ebp
6FC59019 mov ebp,esp
6FC5901B mov edx,dword ptr [ebp+0Ch]
6FC5901E mov eax,dword ptr [ebp+8]
6FC59021 lock xadd dword ptr [eax],edx ; Failed here
6FC59025 mov eax,edx
6FC59027 pop ebp
6FC59028 ret