This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
freebsd vs std::numeric_limits
- From: Richard Henderson <rth at redhat dot com>
- To: Loren James Rittle <rittle at latour dot rsch dot comm dot mot dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 21 Oct 2002 17:39:07 -0700
- Subject: freebsd vs std::numeric_limits
Would you try this and see if it fixes things for you?
r~
Index: real.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/real.c,v
retrieving revision 1.101
diff -c -p -d -r1.101 real.c
*** real.c 22 Oct 2002 00:17:14 -0000 1.101
--- real.c 22 Oct 2002 00:35:54 -0000
*************** const struct real_format ieee_extended_i
*** 3200,3205 ****
--- 3200,3222 ----
true
};
+ /* The following caters to i386 systems that set the rounding precision
+ to 53 bits instead of 64, e.g. FreeBSD. */
+ const struct real_format ieee_extended_intel_96_round_53_format =
+ {
+ encode_ieee_extended,
+ decode_ieee_extended,
+ 2,
+ 1,
+ 53,
+ -16381,
+ 16384,
+ true,
+ true,
+ true,
+ true,
+ true
+ };
/* IBM 128-bit extended precision format: a pair of IEEE double precision
numbers whose sum is equal to the extended precision value. The number
Index: real.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/real.h,v
retrieving revision 1.59
diff -c -p -d -r1.59 real.h
*** real.h 22 Oct 2002 00:17:15 -0000 1.59
--- real.h 22 Oct 2002 00:35:54 -0000
*************** extern const struct real_format ieee_sin
*** 221,226 ****
--- 221,227 ----
extern const struct real_format ieee_double_format;
extern const struct real_format ieee_extended_motorola_format;
extern const struct real_format ieee_extended_intel_96_format;
+ extern const struct real_format ieee_extended_intel_96_round_53_format;
extern const struct real_format ieee_extended_intel_128_format;
extern const struct real_format ibm_extended_format;
extern const struct real_format ieee_quad_format;
Index: config/i386/freebsd.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/freebsd.h,v
retrieving revision 1.32
diff -c -p -d -r1.32 freebsd.h
*** config/i386/freebsd.h 12 Apr 2002 01:18:37 -0000 1.32
--- config/i386/freebsd.h 22 Oct 2002 00:35:54 -0000
*************** Boston, MA 02111-1307, USA. */
*** 138,140 ****
--- 138,150 ----
#undef DEFAULT_PCC_STRUCT_RETURN
#define DEFAULT_PCC_STRUCT_RETURN 0
+
+ /* FreeBSD sets the rounding precision of the FPU to 53 bits. Let the
+ compiler get the contents of <float.h> and std::numeric_limits correct. */
+ #define SUBTARGET_OVERRIDE_OPTIONS \
+ do { \
+ real_format_for_mode[XFmode - QFmode] \
+ = &ieee_extended_intel_96_round_53_format; \
+ real_format_for_mode[TFmode - QFmode] \
+ = &ieee_extended_intel_96_round_53_format; \
+ } while (0)