aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-ssa-sprintf.c
AgeCommit message (Collapse)AuthorFilesLines
2016-09-28gimple-ssa-sprintf.c (pass_sprintf_length::gate): Use x > 0 instead of 0 < x.Jakub Jelinek1-8/+9
* gimple-ssa-sprintf.c (pass_sprintf_length::gate): Use x > 0 instead of 0 < x. (format_floating, format_string, format_directive, get_destination_size, pass_sprintf_length::handle_gimple_call): Likewise. From-SVN: r240600
2016-09-28gimple-ssa-sprintf.c: Fix comment formatting.Jakub Jelinek1-25/+17
* gimple-ssa-sprintf.c: Fix comment formatting. (format_integer): Use is_gimple_assign. (pass_sprintf_length::handle_gimple_call): Use gimple_call_builtin_p and gimple_call_fndecl. Reorder case BUILT_IN_SPRINTF_CHK. Fix up BUILT_IN_SNPRINTF_CHK comment. Replace "to to" with "to" in comment. (pass_sprintf_length::execute): Use is_gimple_call. From-SVN: r240594
2016-09-28PR c/77762 - Incorrect destination buffer length in -Wformat-length warningMartin Sebor1-2/+2
gcc/testsuite/ChangeLog: PR c/77762 * gcc.dg/tree-ssa/builtin-sprintf-warn-1.c (test_vsnprintf_chk_s): Call __builtin___vsnprintf_chk, not __builtin___snprintf_chk. (test_sprintf_p_const): Adjust line numbers to avoid failures introduced in r240503. gcc/ChangeLog: PR c/77762 * gimple-ssa-sprintf.c (pass_sprintf_length::handle_gimple_call): Fix typos. From-SVN: r240584
2016-09-28PR middle-end/77683 - ICE on %lf directive in format_floating inMartin Sebor1-3/+25
gcc/testsuite/ChangeLog: PR middle-end/77683 * gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: Add test cases. gcc/ChangeLog: PR middle-end/77683 * gimple-ssa-sprintf.c (format_integer): Fail gracefully when length modifier is not expected. (format_floating): Ignore l length modifier and fail gracefuly when it isn't one of the other expected ones. From-SVN: r240583
2016-09-22PR target/77676 - powerpc64 and powerpc64le stage2 bootstrap failMartin Sebor1-12/+21
gcc/testsuite/ChangeLog: PR target/77676 * gcc.dg/tree-ssa/builtin-sprintf-1.c: Define and use wint_t. * gcc.dg/tree-ssa/builtin-sprintf-2.c: Fix typo. * gcc.dg/tree-ssa/builtin-sprintf-3.c: New test. * gcc.dg/tree-ssa/builtin-sprintf-warn-5.c: New test. gcc/ChangeLog: PR target/77676 * gimple-ssa-sprintf.c (target_int_min, target_int_max): Use HOST_BITS_PER_WIDE_INT, make a static local variable auto. (target_int_min): Correct computation. (format_integer): Use long long as the argument for the ll length modifier. (format_floating): Use target_int_max(). (get_string_length): Same. (format_string): Avoid setting the bounded flag for strings of unknown length. (try_substitute_return_value): Avoid setting range info when the result isn't bounded. * varasm.c (assemble_name): Increase buffer size. From-SVN: r240383
2016-09-22Use GMP_RNDN for portability to MPFR 2.4.2Rainer Orth1-2/+2
* gimple-ssa-sprintf.c (format_floating_max): Use GMP_RNDN instead of MPFR_RNDN. (format_floating): Likewise. From-SVN: r240350
2016-09-21gimple-ssa-sprintf.c (pass_sprintf_length::compute_format_length): Add falls ↵Marek Polacek1-0/+1
through comment. * gimple-ssa-sprintf.c (pass_sprintf_length::compute_format_length): Add falls through comment. From-SVN: r240311
2016-09-20PR middle-end/49905 - Better sanity checking on sprintf src & dest toMartin Sebor1-0/+2686
gcc/ChangeLog: PR middle-end/49905 * Makefile.in (OBJS): Add gimple-ssa-sprintf.o. * config/linux.h (TARGET_PRINTF_POINTER_FORMAT): Redefine. * config/linux.c (gnu_libc_printf_pointer_format): New function. * config/sol2.h (TARGET_PRINTF_POINTER_FORMAT): Same. * config/sol2.c (solaris_printf_pointer_format): New function. * doc/invoke.texi (-Wformat-length, -fprintf-return-value): New options. * doc/tm.texi.in (TARGET_PRINTF_POINTER_FORMAT): Document. * doc/tm.texi: Regenerate. * gimple-fold.h (get_range_strlen): New function. (get_maxval_strlen): Declare existing function. * gimple-fold.c (get_range_strlen): Add arguments and compute both maximum and minimum. (get_range_strlen): Define overload. (get_maxval_strlen): Adjust. * gimple-ssa-sprintf.c: New file and pass. * passes.def (pass_sprintf_length): Add new pass. * targhooks.h (default_printf_pointer_format): Declare new function. (gnu_libc_printf_pointer_format): Same. (solaris_libc_printf_pointer_format): Same. * targhooks.c (default_printf_pointer_format): Define new function. * tree-pass.h (make_pass_sprintf_length): Declare new function. * print-tree.c: Increase buffer size. gcc/c-family/ChangeLog: PR middle-end/49905 * c.opt: Add -Wformat-length and -fprintf-return-value. gcc/testsuite/ChangeLog: PR middle-end/49905 * gcc.dg/builtin-stringop-chk-1.c: Adjust. * gcc.dg/tree-ssa/builtin-sprintf-warn-1.c: New test. * gcc.dg/tree-ssa/builtin-sprintf-warn-2.c: New test. * gcc.dg/tree-ssa/builtin-sprintf-warn-3.c: New test. * gcc.dg/tree-ssa/builtin-sprintf-warn-4.c: New test. * gcc.dg/tree-ssa/builtin-sprintf.c: New test. * gcc.dg/tree-ssa/builtin-sprintf-2.c: New test. From-SVN: r240298