Matt Fago <fago@xxxxxxxxxxxxx> writes: > > This is some weird bug. It should work as you expect. It does work > > in my testing on GNU/Linux. > > > > Try using the -v option when you compile. It should show how > > -march=native is transformed when the gcc driver invokes the compiler > > proper. > > > > Ian > > > I'm not sure this gets anything useful? I usually build gcc on Linux > as well, so ... > /usr/local/bin/gcc -v -c -O3 -march=native Weapon.c > /usr/local/libexec/gcc/i386-apple-darwin8.10.1/4.2.1/cc1 -quiet -v - > D__DYNAMIC__ Weapon.c -fPIC -quiet -dumpbase Weapon.c -march=native - > auxbase Weapon -O3 -version -o /var/tmp//ccSVG0aD.s The problem is that the driver code is not working, and the bug is that gcc doesn't handle that correctly. There is some code in gcc to handle the driver code failing, and it works for -mtune=native, but not for -march=native. The driver code is supposed to change the -march=native to be -march=XXX for your CPU. The code is in gcc/config/i386/driver-i386.c. OK, I see the problem. The code in gcc/config/i386/linux.h looks like this: #define CC1_SPEC "%(cc1_cpu) %{profile:-p}" gcc/config/i386/darwin.h looks like this: #define CC1_SPEC "%{!mkernel:%{!static:%{!mdynamic-no-pic:-fPIC}}} \ %{!mmacosx-version-min=*:-mmacosx-version-min=%(darwin_minversion)} \ %{g: %{!fno-eliminate-unused-debug-symbols: -feliminate-unused-debug-symbols }}" The version in darwin.h is missing the %(cc1_cpu). So there are two bugs: the darwin.h code does not invoke the driver code for -march=native or -mtune=native, and the i386.c code does not correctly handle -march=native. The effect of the first bug is that neither -march=native nor -mtune=native work on Darwin. The effect of the second bug is that -march=native actually gives an error, rather than being equivalent to -march=generic. Can you file a bug report for this problem at http://gcc.gnu.org/bugzilla/? Thanks. Ian