diff options
author | Martin Sebor <msebor@redhat.com> | 2017-01-10 21:02:07 +0000 |
---|---|---|
committer | Martin Sebor <msebor@gcc.gnu.org> | 2017-01-10 14:02:07 -0700 |
commit | c16880eff008084f55a56a07cb7a16453d2b94c4 (patch) | |
tree | 7937fe84404fc72318c09a1797cd2d2d23fdd4c1 /gcc/builtins.c | |
parent | 5d58291930dab0a54f7d2c0e5e272a1ea9b18aad (diff) | |
download | gcc-c16880eff008084f55a56a07cb7a16453d2b94c4.zip gcc-c16880eff008084f55a56a07cb7a16453d2b94c4.tar.gz gcc-c16880eff008084f55a56a07cb7a16453d2b94c4.tar.bz2 |
PR tree-optimization/78775 - [7 Regression] ICE in maybe_warn_alloc_args_overflow
gcc/ChangeLog:
PR tree-optimization/78775
* builtins.c (get_size_range): Move...
* calls.c: ...to here.
(alloc_max_size): Accept zero argument.
(operand_signed_p): Remove.
(maybe_warn_alloc_args_overflow): Call get_size_range.
* calls.h (get_size_range): Declare.
gcc/testsuite/ChangeLog:
PR tree-optimization/78775
* gcc.dg/attr-alloc_size-4.c: Add test cases.
* gcc.dg/attr-alloc_size-10.c: New test.
* gcc.dg/attr-alloc_size-11.c: New test.
* gcc.dg/builtin-stringop-chk-7.c: New test.
* gcc.dg/pr78775.c: New test.
* gcc.dg/pr78973-2.c: New test.
* gcc.dg/pr78973.c: New test.
From-SVN: r244290
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r-- | gcc/builtins.c | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c index 5b76dfd..bf68e31 100644 --- a/gcc/builtins.c +++ b/gcc/builtins.c @@ -3031,42 +3031,6 @@ expand_builtin_memcpy_args (tree dest, tree src, tree len, rtx target, tree exp) return dest_addr; } -/* Fill the 2-element RANGE array with the minimum and maximum values - EXP is known to have and return true, otherwise null and return - false. */ - -static bool -get_size_range (tree exp, tree range[2]) -{ - if (tree_fits_uhwi_p (exp)) - { - range[0] = range[1] = exp; - return true; - } - - if (TREE_CODE (exp) == SSA_NAME) - { - wide_int min, max; - enum value_range_type range_type = get_range_info (exp, &min, &max); - - if (range_type == VR_RANGE) - { - /* Interpret the bound in the variable's type. */ - range[0] = wide_int_to_tree (TREE_TYPE (exp), min); - range[1] = wide_int_to_tree (TREE_TYPE (exp), max); - return true; - } - else if (range_type == VR_ANTI_RANGE) - { - /* FIXME: Handle anti-ranges. */ - } - } - - range[0] = NULL_TREE; - range[1] = NULL_TREE; - return false; -} - /* Try to verify that the sizes and lengths of the arguments to a string manipulation function given by EXP are within valid bounds and that the operation does not lead to buffer overflow. Arguments other than |