Atomic builtins always defined -- bug or feature?

Andrew Haley aph@redhat.com
Fri Jun 5 18:57:00 GMT 2009


Joseph Garvin wrote:
> On Fri, Jun 5, 2009 at 11:47 AM, Andrew Haley<aph@redhat.com> wrote:
>> It'll call out to a library function if there isn't a builtin instruction.
>> If you want to do a configure check, try running or linking the program.
> 
> If I compile with -march=i386, and do ./a.out, it runs without errors.
> Here's my .cpp file:
> 
> int main()
> {
> 	int x;
> 	__sync_add_and_fetch(&x, 1);
> 
> 	return 0;
> }
> 
> Since I have a main, if __sync_add_and_fetch were undefined, wouldn't
> it already be trying to link and give an error?

i386 has lock incl, surely, so __sync_add_and_fetch isn't a problem.
It's stuff like __sync_val_compare_and_swap you don't have.

Andrew.



More information about the Gcc-help mailing list