aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-ssa-sprintf.c
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2018-08-04 22:14:41 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2018-08-04 16:14:41 -0600
commitbd1f3566b12eb1e86d17b0c8c84c91ea5e9844b3 (patch)
tree3fbbd1d1d4e5ae5e48b60c60e8dafb6df2f5e174 /gcc/gimple-ssa-sprintf.c
parent3d3e5ba2622feb993d38d805c73fbcae8397a943 (diff)
downloadgcc-bd1f3566b12eb1e86d17b0c8c84c91ea5e9844b3.zip
gcc-bd1f3566b12eb1e86d17b0c8c84c91ea5e9844b3.tar.gz
gcc-bd1f3566b12eb1e86d17b0c8c84c91ea5e9844b3.tar.bz2
PR tree-optimization/86571 - AIX NaNQ and NaNS output format conflicts with __builtin_sprintf
gcc/ChangeLog: PR tree-optimization/86571 * gimple-ssa-sprintf.c (format_floating): Extend upper bound of NaN output to 4. From-SVN: r263312
Diffstat (limited to 'gcc/gimple-ssa-sprintf.c')
-rw-r--r--gcc/gimple-ssa-sprintf.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c
index bda738d..c652c55 100644
--- a/gcc/gimple-ssa-sprintf.c
+++ b/gcc/gimple-ssa-sprintf.c
@@ -2014,8 +2014,15 @@ format_floating (const directive &dir, tree arg, vr_values *)
res.range.likely = res.range.min;
res.range.max = res.range.min;
- /* The inlikely maximum is "[-/+]infinity" or "[-/+]nan". */
- res.range.unlikely = sign + (real_isinf (rvp) ? 8 : 3);
+ /* The unlikely maximum is "[-/+]infinity" or "[-/+][qs]nan".
+ For NaN, the C/POSIX standards specify two formats:
+ "[-/+]nan"
+ and
+ "[-/+]nan(n-char-sequence)"
+ No known printf implementation outputs the latter format but AIX
+ outputs QNaN and SNaN for quiet and signalling NaN, respectively,
+ so the unlikely maximum reflects that. */
+ res.range.unlikely = sign + (real_isinf (rvp) ? 8 : 4);
/* The range for infinity and NaN is known unless either width
or precision is unknown. Width has the same effect regardless