Joseph Garvin wrote: > I'm trying to write a configure check for whether the __sync atomic > builtin functions are present -- and it never fails! For some reason, > now whenever I tell g++ to compile an example .cpp file that uses the > __sync instructions, it compiles without errors, even if I don't > provide the march flag. Also, my CFLAGS, CPPFLAGS, and CXXFLAGS are > empty, so it should be using the defaults. In fact, if I deliberately > specify -march=i386, it STILL compiles fine, when it should fail since > the 386 had no lock instructions. Indeed, I have seen __sync using > software fail to compile until CXXFLAGS="-march=i686" was specified, > but for some reason invoking g++ myself outside of any build tool > doesn't trigger this behavior. > > It seems to be using my native architecture even if I deliberately > tell it not to, which makes it hard to verify my configure script > works correctly in the failure case. Is this a bug or a feature? > Either way it's undesirable for me in this particular case.... My GCC > version is 4.2.2 on Solaris. 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. Andrew.