sync_add_and_fetch problem
David Daney
ddaney@caviumnetworks.com
Thu Dec 4 02:20:00 GMT 2008
Charles Crisler wrote:
> Thank you. I had already found your reference.
>
> Which file contains the definition of this built-in function?
>
It is built-in to the compiler (that is why it is called a "Built-in
function for atomic memory access"), so it doesn't really exist in any
file external to the compiler. The only place it is documented is in
the compiler's manual.
> I suppose that I could write a main() that called an increment function
> and that function could call this function.
>
> What would you need? If I supply just source it would seem that wouldn't
> be worth much.
I don't really understand your question.
You could look in the compiler's testsuite at these programs to see how
to use it:
gcc/testsuite/gcc.dg/sync-1.c
gcc/testsuite/gcc.dg/sync-2.c
gcc/testsuite/gcc.dg/sync-3.c
>
> My co-workers are using v. 4.2.4, though one just built the entire
> system with 4.3.2 and it did not have this problem. However, I would
> kind of like to isolate the problem before I upgrade, which is why I
> asked about the file it is defined in. I greped -inr
> "__sync_add_and_fetch" /usr/include/*.h and didn't find it. Since that
> module compiles without a warning, that suggests that the compiler found
> it.
See above, it doesn't exist external to the compiler.
David Daney
More information about the Gcc-help
mailing list