Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] to_string does not work inside omp parallel #43

Open
planetA opened this issue Jun 22, 2017 · 7 comments
Open

[BUG] to_string does not work inside omp parallel #43

planetA opened this issue Jun 22, 2017 · 7 comments
Labels

Comments

@planetA
Copy link

planetA commented Jun 22, 2017

Hi,

here is a minimal example

#include <iostream>
#include <string>

int main()
{
  int a = 2222;
#pragma omp parallel for
  for (int i = 0; i < 10000; i++) {
    std::cout << a << std::endl;
    std::cout << std::to_string(a) << std::endl;
  }
}

without archer it prints 2222 all the time with archer to_string prints 4986765

Version:

clang version 3.9.1 (tags/RELEASE_391/final)
Target: x86_64-unknown-linux-gnu

@simoatze simoatze added the bug label Jun 22, 2017
@simoatze
Copy link
Member

simoatze commented Jun 22, 2017

Hi,

thanks for reporting this problem. This is actually a known problem, our static analysis pass does not work well with C++ code, especially with third-party library (such as the std lib).

As a temporary fix you can run archer without static analysis just removing this string -Xclang -load -Xclang /your/path/LLVMArcher.so from clang-archer and clang-archer++ commands.

@planetA
Copy link
Author

planetA commented Jun 22, 2017

I replaced to_string with snprintf, so this kind of solved the problem. But I suspect that archer may miss some race conditions, because I get non-deterministic result in my program when I shouldn't. Would you advise me not to use C++ with archer at all?

@simoatze
Copy link
Member

As I said, Archer static analysis phase has troubles with C++, if you remove the pass from the archer commands it would only apply the dynamic analysis at runtime and everything should work fine even with C++.

@planetA
Copy link
Author

planetA commented Jun 22, 2017

OK. Thank you.

@dongahn
Copy link
Contributor

dongahn commented Jun 22, 2017

@simoatze: should this limitation be documented somewhere? In particular, how do can disable the static analysis?

@simoatze
Copy link
Member

@dongahn I was thinking to add an option in the archer drivers to disable the static analysis

@dongahn
Copy link
Contributor

dongahn commented Jun 22, 2017

yeah, that be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants