This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How to default to -fno-math-errno on all FreeBSD targets


David Schultz noticed that the FreeBSD libm does not set errno, never
has done, and never will, and thus has made -fno-math-errno the default
in the (old, GCC 4.2-based) system compiler:

  http://svn.freebsd.org/viewvc/base?view=revision&revision=181538


We should also make this change for GCC 4.6 and possibly retroactively
GCC 4.5 since we are giving away performance for nothing.  


Our documentation already notes that this is the case on Darwin

  On Darwin systems, the math library never sets @code{errno}.  There is
  therefore no reason for the compiler to consider the possibility that
  it might, and @option{-fno-math-errno} is the default.

which hacks config/i386/i386.c as follows:

  ix86_option_init_struct (struct gcc_options *opts)
  {
    if (TARGET_MACHO)
      /* The Darwin libraries never set errno, so we might as well
         avoid calling them when that's the only reason we would.  */
      opts->x_flag_errno_math = 0;

I guess I could just add a check for FSB_MAJOR there, but that would
only address i386.  Is there a better way to accomplish this?

Gerald


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]