]>
Commit | Line | Data |
---|---|---|
b5b0b447 ER |
1 | 2014-12-12 Jakub Jelinek <jakub@redhat.com> |
2 | ||
3 | PR tree-optimization/64269 | |
4 | * tree-ssa-forwprop.c (simplify_builtin_call): Bail out if | |
5 | len2 or diff are too large. | |
6 | ||
7 | * gcc.c-torture/compile/pr64269.c: New test. | |
8 | ||
9 | --- gcc/tree-ssa-forwprop.c.jj 2014-12-01 14:57:30.000000000 +0100 | |
10 | +++ gcc/tree-ssa-forwprop.c 2014-12-12 09:46:05.790053928 +0100 | |
11 | @@ -1288,7 +1288,8 @@ simplify_builtin_call (gimple_stmt_itera | |
12 | use_operand_p use_p; | |
13 | ||
14 | if (!tree_fits_shwi_p (val2) | |
15 | - || !tree_fits_uhwi_p (len2)) | |
16 | + || !tree_fits_uhwi_p (len2) | |
17 | + || compare_tree_int (len2, 1024) == 1) | |
18 | break; | |
19 | if (is_gimple_call (stmt1)) | |
20 | { | |
21 | @@ -1354,7 +1355,8 @@ simplify_builtin_call (gimple_stmt_itera | |
22 | is not constant, or is bigger than memcpy length, bail out. */ | |
23 | if (diff == NULL | |
24 | || !tree_fits_uhwi_p (diff) | |
25 | - || tree_int_cst_lt (len1, diff)) | |
26 | + || tree_int_cst_lt (len1, diff) | |
27 | + || compare_tree_int (diff, 1024) == 1) | |
28 | break; | |
29 | ||
30 | /* Use maximum of difference plus memset length and memcpy length | |
31 | --- gcc/testsuite/gcc.c-torture/compile/pr64269.c.jj 2014-12-12 09:47:04.795015479 +0100 | |
32 | +++ gcc/testsuite/gcc.c-torture/compile/pr64269.c 2014-12-12 09:46:51.000000000 +0100 | |
33 | @@ -0,0 +1,9 @@ | |
34 | +/* PR tree-optimization/64269 */ | |
35 | + | |
36 | +void | |
37 | +foo (char *p) | |
38 | +{ | |
39 | + __SIZE_TYPE__ s = ~(__SIZE_TYPE__)0; | |
40 | + *p = 0; | |
41 | + __builtin_memset (p + 1, 0, s); | |
42 | +} |