Message ID | 20170124093757.GA288@x4 |
---|---|
State | New |
Headers | show |
On 01/24/2017 02:37 AM, Markus Trippelsdorf wrote: > MPFR_RNDx was introduced in MPFR 3.0.0. Since the minimal version that > gcc checks for is 2.4.0, this leads to a build failure. > > The fix is straightforward. > > Tested on x86_64-pc-linux-gnu. Committed to trunk as obvious. > > * gimple-ssa-sprintf.c (format_floating): Change MPFR_RNDx to > GMP_RNDx for compatibility. This was changed once before for this reason (in r240350). I forgot all about it and put it back in my latest patch for some reason. I don't remember why exactly but I suspect I might have been trying to overcome some MPFR oddity. It might help to #undef the MPFR_RNDx macros after including <mpfr.h> to avoid this in the future. In any event, thanks for the fix. Martin
Hi Martin, > On 01/24/2017 02:37 AM, Markus Trippelsdorf wrote: >> MPFR_RNDx was introduced in MPFR 3.0.0. Since the minimal version that >> gcc checks for is 2.4.0, this leads to a build failure. >> >> The fix is straightforward. >> >> Tested on x86_64-pc-linux-gnu. Committed to trunk as obvious. >> >> * gimple-ssa-sprintf.c (format_floating): Change MPFR_RNDx to >> GMP_RNDx for compatibility. > > This was changed once before for this reason (in r240350). I forgot > all about it and put it back in my latest patch for some reason. I > don't remember why exactly but I suspect I might have been trying to > overcome some MPFR oddity. It might help to #undef the MPFR_RNDx > macros after including <mpfr.h> to avoid this in the future. In any > event, thanks for the fix. we certainly should do something like this: your latest patch introduced the same failure again: /vol/gcc/src/hg/trunk/local/gcc/gimple-ssa-sprintf.c: In function 'long long unsigned int {anonymous}::format_floating_max(tree, char, long long int)': /vol/gcc/src/hg/trunk/local/gcc/gimple-ssa-sprintf.c:1501:27: error: 'MPFR_RNDN' was not declared in this scope mpfr_from_real (x, &rv, MPFR_RNDN); ^ Makefile:1098: recipe for target 'gimple-ssa-sprintf.o' failed make[3]: *** [gimple-ssa-sprintf.o] Error 1 Rainer
On 2017.01.27 at 08:41 +0100, Rainer Orth wrote: > Hi Martin, > > > On 01/24/2017 02:37 AM, Markus Trippelsdorf wrote: > >> MPFR_RNDx was introduced in MPFR 3.0.0. Since the minimal version that > >> gcc checks for is 2.4.0, this leads to a build failure. > >> > >> The fix is straightforward. > >> > >> Tested on x86_64-pc-linux-gnu. Committed to trunk as obvious. > >> > >> * gimple-ssa-sprintf.c (format_floating): Change MPFR_RNDx to > >> GMP_RNDx for compatibility. > > > > This was changed once before for this reason (in r240350). I forgot > > all about it and put it back in my latest patch for some reason. I > > don't remember why exactly but I suspect I might have been trying to > > overcome some MPFR oddity. It might help to #undef the MPFR_RNDx > > macros after including <mpfr.h> to avoid this in the future. In any > > event, thanks for the fix. > > we certainly should do something like this: your latest patch introduced > the same failure again: Well, you cannot #undef enum members like MPFR_RNDU.
On Fri, 27 Jan 2017, Rainer Orth wrote: > > This was changed once before for this reason (in r240350). I forgot > > all about it and put it back in my latest patch for some reason. I > > don't remember why exactly but I suspect I might have been trying to > > overcome some MPFR oddity. It might help to #undef the MPFR_RNDx > > macros after including <mpfr.h> to avoid this in the future. In any > > event, thanks for the fix. > > we certainly should do something like this: your latest patch introduced Such as increasing the minimum version so we don't need to use deprecated interfaces (GMP_RND*) in GCC.
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c index 66edc3ec1cc9..283b6251d743 100644 --- a/gcc/gimple-ssa-sprintf.c +++ b/gcc/gimple-ssa-sprintf.c @@ -1560,7 +1560,7 @@ format_floating (const directive &dir, tree arg) rounding in either direction can result in longer output. */ mpfr_t mpfrval; mpfr_init2 (mpfrval, rfmt->p); - mpfr_from_real (mpfrval, rvp, i ? MPFR_RNDU : MPFR_RNDD); + mpfr_from_real (mpfrval, rvp, i ? GMP_RNDU : GMP_RNDD); /* Use the MPFR rounding specifier to round down in the first iteration and then up. In most but not all cases this will