different behaviour compiled by clang vs GCC

Hello,

I have a multi-thread program, which behaves differently when compiled by GCC or clang (exactly the same source code; same CMakeLists.txt ).

The main difference is that when it is compiled by GCC, the internal memory buffer of the program is never cleaned (but it is when the program is compiled by clang).

The variable that is used as signal for clearing the buffer is a global atomic long integer (int64_t), shared by all the threads, and created at the beginning by the main thread. This atomic variable change during the execution, so it seems that the change is not seen by the threads.

Any suggestion would be welcome.

Thank you for your time.

Regards,
ORF
Not much to say without looking at some code. Do you have a minimum reproducible example?
Hello,

Thanks for a quick reply.

I would need a while (12-24h) for preparing a minimum example...

Best regards,
ORF
No rush. The site's not going anywhere.
Remember to include the versions of each compiler.
also, see what happens if you put the volatile keyword on the variable in question.
this isnt a fix, but a test, even if it fixes it, its probably not the best solution.
Topic archived. No new replies allowed.