Hi Martin,
>> Another nit, if I may: FWIW I'm not in love with the wording of the
>> messages. Sorry to bikeshed, but how about:
>> warning: buffer overflow will occur when writing terminating NUL
>> and:
>> note: formatted output of 2 bytes into a destination of size 1
>> or somesuch.
>
> I won't claim the text of the messages is perfect but I did spend
> a lot of time tweaking them. That's not to say they can't be
> improved but changing them means quite a bit of work adjusting
> the tests. At this point, I'd like to focus on getting the patch
> committed. After that, if there's still time, I'm happy to take
> feedback and tweak the diagnostics based on it.
>
> Thanks again for your help and the suggestions above!
your patch broke bootstrap with MPFR 2.4.2, which is still the
recommended (or perhaps minimal) version according to install.texi:
/vol/gcc/src/hg/trunk/local/gcc/gimple-ssa-sprintf.c: In function 'int
{anonymous}::format_floating_max(tree, char)':
/vol/gcc/src/hg/trunk/local/gcc/gimple-ssa-sprintf.c:1128:27: error:
'MPFR_RNDN' was not declared in this scope
mpfr_from_real (x, &rv, MPFR_RNDN);
^
/vol/gcc/src/hg/trunk/local/gcc/gimple-ssa-sprintf.c: In function
'{anonymous}::fmtresult {anonymous}::format_floating(const
{anonymous}::conversion_spec&, tree)':
/vol/gcc/src/hg/trunk/local/gcc/gimple-ssa-sprintf.c:1328:37: error:
'MPFR_RNDN' was not declared in this scope
mpfr_from_real (mpfrval, rvp, MPFR_RNDN);
^
MPFR_RNDN was only introduced in mpfr 3.0.0, and everywhere else in gcc
GMP_RNDN is used instead. mpfr 3.0.0 <mpfr.h> has
/* kept for compatibility with MPFR 2.4.x and before */
#define GMP_RNDN MPFR_RNDN
The following patch (together with your other one to fix ILP32 targets)
allows a sparc-sun-solaris2.12 bootstrap to continue. I'm going to
commit it as obvious.
Rainer
2016-09-22 Rainer Orth <[email protected]>
gcc:
* gimple-ssa-sprintf.c (format_floating_max): Use GMP_RNDN instead
of MPFR_RNDN.
(format_floating): Likewise.
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c
--- a/gcc/gimple-ssa-sprintf.c
+++ b/gcc/gimple-ssa-sprintf.c
@@ -1125,7 +1127,7 @@ format_floating_max (tree type, char spe
round-to-nearest mode. */
mpfr_t x;
mpfr_init2 (x, rfmt->p);
- mpfr_from_real (x, &rv, MPFR_RNDN);
+ mpfr_from_real (x, &rv, GMP_RNDN);
const char fmt[] = { '%', 'R', spec, '\0' };
int n = mpfr_snprintf (NULL, 0, fmt, x);
@@ -1325,7 +1327,7 @@ format_floating (const conversion_spec &
round-to-nearest mode. */
mpfr_t mpfrval;
mpfr_init2 (mpfrval, rfmt->p);
- mpfr_from_real (mpfrval, rvp, MPFR_RNDN);
+ mpfr_from_real (mpfrval, rvp, GMP_RNDN);
char fmtstr [40];
char *pfmt = fmtstr;
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University