Avoid general use of GCC march native flag

The GCC -march=native flag can cause unexpected and difficult to diagnose error messages on certain CPU arches, including high end Intel Xeon CPUs. The compiler error messages generally don’t give any clues as to what the real problem may be. While there can be a small to significant performance benefit to using the GCC flags enabling special features in a CPU arch, we feel it’s important to provide software that “just works” by default, even if not completely optimized for a given CPU. The end users that care most about performance probably have already learned the appropriate flags for their CPU, and are willing to fiddle with the CPU arch flags to get the program running at optimum.

We generally have no problems using the GCC -mtune=native flag.

GCC CPU flags

GCC will show a neat list of which flags are enabled and disabled like:

gfortran -Q --help=target foo.f90

Or to just show the raw flags being used

gfortran -v foo.f90

Reference