On 01/03/2012 03:39 PM, Markus Henschel wrote: >> -----Original Message----- >> From: gcc-help-owner@xxxxxxxxxxx [mailto:gcc-help-owner@xxxxxxxxxxx] On >> Behalf Of Andrew Haley >> Sent: Dienstag, 3. Januar 2012 16:26 >> To: gcc-help@xxxxxxxxxxx >> Subject: Re: Questions before submitting a bug report >> >> On 01/03/2012 03:02 PM, Markus Henschel wrote: >>> Is there some obvious flaw in my code? >> >> What error did you get? Not all CPUs can do __sync_add_and_fetch on a >> long long. > > The resulting program crashes with a segmentation fault on the line with __sync_add_and_fetch. This is the complete command line I used for compiling: > > "gcc -fPIC -march=i586 -fvisibility=hidden -O3 mytest.c -o mytest" > > The error goes away if I remove "-fPIC", "-fvisibility=hidden" or if I use some less aggressive optimization. It also disappears if I use a long instead of a long long. I think you've found yourself a bug. I can't reproduce it, nor can I see anything wrong with your code. It's be interesting to see what instruction makes it crash. Andrew.