diff options
author | Martin Sebor <msebor@redhat.com> | 2018-01-03 20:38:30 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2018-01-03 13:38:30 -0700 |
commit | a6fd2cd769c3bb446085e45794fcb22481eed400 (patch) | |
tree | 8e3d75d5168c0b68ab7bdbbb2f7b0e8551b53fd9 /gcc/gimple-ssa-sprintf.c | |
parent | 830421fcd37719426fa8eb7f0d545c744db497b4 (diff) | |
download | gcc-a6fd2cd769c3bb446085e45794fcb22481eed400.tar.gz |
gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): Use offset_int::from instead of wide_int::to_shwi.
gcc/ChangeLog:
* gimple-ssa-warn-restrict.c (builtin_memref::builtin_memref): Use
offset_int::from instead of wide_int::to_shwi.
(maybe_diag_overlap): Remove assertion.
Use HOST_WIDE_INT_PRINT_DEC instead of %lli.
* gimple-ssa-sprintf.c (format_directive): Same.
(parse_directive): Same.
(sprintf_dom_walker::compute_format_length): Same.
(try_substitute_return_value): Same.
gcc/testsuite/ChangeLog:
* gcc.dg/Wrestrict-3.c: New test.
From-SVN: r256187
Diffstat (limited to 'gcc/gimple-ssa-sprintf.c')
-rw-r--r-- | gcc/gimple-ssa-sprintf.c | 73 |
1 files changed, 43 insertions, 30 deletions
diff --git a/gcc/gimple-ssa-sprintf.c b/gcc/gimple-ssa-sprintf.c index b7d7cd55f7a..7d16bbd16f8 100644 --- a/gcc/gimple-ssa-sprintf.c +++ b/gcc/gimple-ssa-sprintf.c @@ -2995,16 +2995,16 @@ format_directive (const sprintf_dom_walker::call_info &info, if (dump_file && *dir.beg) { - fprintf (dump_file, " Result: %lli, %lli, %lli, %lli " - "(%lli, %lli, %lli, %lli)\n", - (long long)fmtres.range.min, - (long long)fmtres.range.likely, - (long long)fmtres.range.max, - (long long)fmtres.range.unlikely, - (long long)res->range.min, - (long long)res->range.likely, - (long long)res->range.max, - (long long)res->range.unlikely); + fprintf (dump_file, + " Result: " + HOST_WIDE_INT_PRINT_DEC ", " HOST_WIDE_INT_PRINT_DEC ", " + HOST_WIDE_INT_PRINT_DEC ", " HOST_WIDE_INT_PRINT_DEC " (" + HOST_WIDE_INT_PRINT_DEC ", " HOST_WIDE_INT_PRINT_DEC ", " + HOST_WIDE_INT_PRINT_DEC ", " HOST_WIDE_INT_PRINT_DEC ")\n", + fmtres.range.min, fmtres.range.likely, + fmtres.range.max, fmtres.range.unlikely, + res->range.min, res->range.likely, + res->range.max, res->range.unlikely); } return true; @@ -3035,11 +3035,12 @@ parse_directive (sprintf_dom_walker::call_info &info, if (dump_file) { - fprintf (dump_file, " Directive %u at offset %llu: \"%.*s\", " - "length = %llu\n", + fprintf (dump_file, " Directive %u at offset " + HOST_WIDE_INT_PRINT_UNSIGNED ": \"%.*s\", " + "length = " HOST_WIDE_INT_PRINT_UNSIGNED "\n", dir.dirno, - (unsigned long long)(size_t)(dir.beg - info.fmtstr), - (int)dir.len, dir.beg, (unsigned long long)dir.len); + (unsigned HOST_WIDE_INT)(size_t)(dir.beg - info.fmtstr), + (int)dir.len, dir.beg, dir.len); } return len - !*str; @@ -3411,25 +3412,34 @@ parse_directive (sprintf_dom_walker::call_info &info, if (dump_file) { - fprintf (dump_file, " Directive %u at offset %llu: \"%.*s\"", - dir.dirno, (unsigned long long)(size_t)(dir.beg - info.fmtstr), + fprintf (dump_file, + " Directive %u at offset " HOST_WIDE_INT_PRINT_UNSIGNED + ": \"%.*s\"", + dir.dirno, + (unsigned HOST_WIDE_INT)(size_t)(dir.beg - info.fmtstr), (int)dir.len, dir.beg); if (star_width) { if (dir.width[0] == dir.width[1]) - fprintf (dump_file, ", width = %lli", (long long)dir.width[0]); + fprintf (dump_file, ", width = " HOST_WIDE_INT_PRINT_DEC, + dir.width[0]); else - fprintf (dump_file, ", width in range [%lli, %lli]", - (long long)dir.width[0], (long long)dir.width[1]); + fprintf (dump_file, + ", width in range [" HOST_WIDE_INT_PRINT_DEC + ", " HOST_WIDE_INT_PRINT_DEC "]", + dir.width[0], dir.width[1]); } if (star_precision) { if (dir.prec[0] == dir.prec[1]) - fprintf (dump_file, ", precision = %lli", (long long)dir.prec[0]); + fprintf (dump_file, ", precision = " HOST_WIDE_INT_PRINT_DEC, + dir.prec[0]); else - fprintf (dump_file, ", precision in range [%lli, %lli]", - (long long)dir.prec[0], (long long)dir.prec[1]); + fprintf (dump_file, + ", precision in range [" HOST_WIDE_INT_PRINT_DEC + HOST_WIDE_INT_PRINT_DEC "]", + dir.prec[0], dir.prec[1]); } fputc ('\n', dump_file); } @@ -3455,8 +3465,10 @@ sprintf_dom_walker::compute_format_length (call_info &info, LOCATION_FILE (callloc), LOCATION_LINE (callloc)); print_generic_expr (dump_file, info.func, dump_flags); - fprintf (dump_file, ": objsize = %llu, fmtstr = \"%s\"\n", - (unsigned long long)info.objsize, info.fmtstr); + fprintf (dump_file, + ": objsize = " HOST_WIDE_INT_PRINT_UNSIGNED + ", fmtstr = \"%s\"\n", + info.objsize, info.fmtstr); } /* Reset the minimum and maximum byte counters. */ @@ -3682,13 +3694,14 @@ try_substitute_return_value (gimple_stmt_iterator *gsi, const char *what = setrange ? "Setting" : "Discarding"; if (retval[0] != retval[1]) fprintf (dump_file, - " %s %s-bounds return value range [%llu, %llu].\n", - what, inbounds, - (unsigned long long)retval[0], - (unsigned long long)retval[1]); + " %s %s-bounds return value range [" + HOST_WIDE_INT_PRINT_UNSIGNED ", " + HOST_WIDE_INT_PRINT_UNSIGNED "].\n", + what, inbounds, retval[0], retval[1]); else - fprintf (dump_file, " %s %s-bounds return value %llu.\n", - what, inbounds, (unsigned long long)retval[0]); + fprintf (dump_file, " %s %s-bounds return value " + HOST_WIDE_INT_PRINT_UNSIGNED ".\n", + what, inbounds, retval[0]); } } |