[LLVMdev] __sync_add_and_fetch in objc block for global variable on ARM

Tim Northover t.p.northover at gmail.com
Wed Apr 8 06:53:44 PDT 2015


> in disas I see dmb ish instruction, but I don't know is it enough.

There should be 2 dmb instructions: one before the ldrex/strex loop
and one after. But I wouldn't expect dropping one to actually cause a
problem in the code you posted.

In what way is "count" corrupted, and how do you observe it? What
assembly is actually produced for the block?

> I understand, my clang is out of date. Moving to new version could be painful )
> Maybe somebody knows, was that bug fixed?

That area's certainly improved, but I'm not aware of any bugs on that
scale ("can't dispatch 32 threads to atomically increment a single
variable and print it") in clang 3.3 so I think something else is
probably going on.

A self-contained, minimal example we can examine would be useful.

Cheers.

Tim.



More information about the llvm-dev mailing list