On Wed, 7 Apr 2021, Patrick McGehearty via Gcc-patches wrote: > + macro_name = XALLOCAVEC (char, name_len > + + sizeof ("__LIBGCC__EXCESS_PRECISION__")); > sprintf (macro_name, "__LIBGCC_%s_EXCESS_PRECISION__", name); > builtin_define_with_int_value (macro_name, excess_precision); > + > + char val_name[64]; > + > + macro_name = XALLOCAVEC (char, name_len > + + sizeof ("__LIBGCC_EPSILON__")); > + sprintf (macro_name, "__LIBGCC_%s_EPSILON__", name); > + sprintf (val_name, "__%s_EPSILON__", float_h_prefix); > + builtin_define_with_value (macro_name, val_name, 0); > + > + macro_name = XALLOCAVEC (char, name_len + sizeof ("__LIBGCC_MAX__")); > + sprintf (macro_name, "__LIBGCC_%s_MAX__", name); > + sprintf (val_name, "__%s_MAX__", float_h_prefix); > + builtin_define_with_value (macro_name, val_name, 0); > + > + macro_name = XALLOCAVEC (char, name_len + sizeof ("__LIBGCC_MIN__")); > + sprintf (macro_name, "__LIBGCC_%s_MIN__", name); > + sprintf (val_name, "__%s_MIN__", float_h_prefix); > + builtin_define_with_value (macro_name, val_name, 0);
I think there's an off-by-one error calculating the allocation sizes for these three macro names. Note that the code just above uses sizeof ("__LIBGCC__EXCESS_PRECISION__") with two underscores between "__LIBGCC" and "EXCESS_PRECISION__", reflecting that the macro name being constructed has both those underscores (around the %s expansion of size name_len). I think the three sizeof calls in the three subsequent allocations likewise need to have both those underscores present in their arguments. > diff --git a/libgcc/config/rs6000/_divkc3.c b/libgcc/config/rs6000/_divkc3.c > index d261f40..f7fa47f 100644 > --- a/libgcc/config/rs6000/_divkc3.c > +++ b/libgcc/config/rs6000/_divkc3.c > @@ -37,29 +37,115 @@ see the files COPYING3 and COPYING.RUNTIME respectively. > If not, see > #define __divkc3 __divkc3_sw > #endif > > +#define RBIG (__LIBGCC_TF_MAX__ / 2) > +#define RMIN (__LIBGCC_TF_MIN__) > +#define RMIN2 (__LIBGCC_TF_EPSILON__) > +#define RMINSCAL (1 / __LIBGCC_TF_EPSILON__) > +#define RMAX2 (RBIG * RMIN2) This file includes quad-float128.h, which does some remapping from TF to KF depending on __LONG_DOUBLE_IEEE128__. I think you probably need to have a similar __LONG_DOUBLE_IEEE128__ conditional here. If __LONG_DOUBLE_IEEE128__ is not defined, use __LIBGCC_KF_* macros instead of __LIBGCC_TF_*; if __LONG_DOUBLE_IEEE128__ is defined, use __LIBGCC_TF_* as above. (Unless the powerpc maintainers say otherwise.) -- Joseph S. Myers jos...@codesourcery.com