aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2017-01-26 23:37:17 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2017-01-26 16:37:17 -0700
commit9976a81057ee36684234cc615df137663494af0d (patch)
tree8e0d2c29a02067bdc6152e97d5a73d3dabe65266 /gcc
parent31c87a433cdbec856c6ed840482ef638ac8fc565 (diff)
downloadgcc-9976a81057ee36684234cc615df137663494af0d.zip
gcc-9976a81057ee36684234cc615df137663494af0d.tar.gz
gcc-9976a81057ee36684234cc615df137663494af0d.tar.bz2
gimple-ssa-sprintf.c (format_floating): Test HAVE_XFmode and HAVE_DFmode before using XFmode or DFmode.
gcc/ChangeLog: * gimple-ssa-sprintf.c (format_floating): Test HAVE_XFmode and HAVE_DFmode before using XFmode or DFmode. (parse_directive): Avoid using the z length modifier to avoid the ISO C++98 does not support the ā€˜z’ gnu_printf length modifier. From-SVN: r244957
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/gimple-ssa-sprintf.c23
2 files changed, 21 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 86c4a0d..ac9a89f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2017-01-26 Martin Sebor <msebor@redhat.com>
+ * gimple-ssa-sprintf.c (format_floating): Test HAVE_XFmode and
+ HAVE_DFmode before using XFmode or DFmode.
+ (parse_directive): Avoid using the z length modifier to avoid
+ the ISO C++98 does not support the ā€˜z’ gnu_printf length modifier.
+
PR middle-end/78703
* gimple-ssa-sprintf.c (adjust_for_width_or_precision): Change
to accept adjustment as an array.
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c
index 61eafac..65144ac 100644
--- a/gcc/gimple-ssa-sprintf.c
+++ b/gcc/gimple-ssa-sprintf.c
@@ -1686,11 +1686,19 @@ format_floating (const directive &dir, tree arg)
prec[0] = -1;
if (prec[1] < 0)
{
+#ifdef HAVE_XFmode
+ /* When L is specified use long double, otherwise double. */
unsigned fmtprec
= (dir.modifier == FMT_LEN_L
? REAL_MODE_FORMAT (XFmode)->p
: REAL_MODE_FORMAT (DFmode)->p);
-
+#elif defined HAVE_DFmode
+ /* No long double support, use double precision for both. */
+ unsigned fmtprec = REAL_MODE_FORMAT (DFmode)->p;
+#else
+ /* No long double or double support. */
+ unsigned fmtprec = 0;
+#endif
/* The precision of the IEEE 754 double format is 53.
The precision of all other GCC binary double formats
is 56 or less. */
@@ -2706,10 +2714,11 @@ parse_directive (pass_sprintf_length::call_info &info,
if (dump_file)
{
- fprintf (dump_file, " Directive %u at offset %zu: \"%.*s\", "
- "length = %zu\n",
- dir.dirno, (size_t)(dir.beg - info.fmtstr),
- (int)dir.len, dir.beg, dir.len);
+ fprintf (dump_file, " Directive %u at offset %llu: \"%.*s\", "
+ "length = %llu\n",
+ dir.dirno,
+ (unsigned long long)(size_t)(dir.beg - info.fmtstr),
+ (int)dir.len, dir.beg, (unsigned long long)dir.len);
}
return len - !*str;
@@ -3029,8 +3038,8 @@ parse_directive (pass_sprintf_length::call_info &info,
if (dump_file)
{
- fprintf (dump_file, " Directive %u at offset %zu: \"%.*s\"",
- dir.dirno, (size_t)(dir.beg - info.fmtstr),
+ fprintf (dump_file, " Directive %u at offset %llu: \"%.*s\"",
+ dir.dirno, (unsigned long long)(size_t)(dir.beg - info.fmtstr),
(int)dir.len, dir.beg);
if (star_width)
{