re PR tree-optimization/87672 (81512c36 causes ICE in bootstrap stage 3 using "-D_FORTIFY_SOURCE=2" (invalid operand in unary operation, incorrect sharing of tree nodes, verify_gimple failed))
gcc: 2018-11-04 Bernd Edlinger <bernd.edlinger@hotmail.de> PR tree-optimization/87672 * gimple-fold.c (gimple_fold_builtin_stxcpy_chk): Gimplify. * tree-ssa-strlen.c (handle_builtin_strcat): Adjust object size. testsuite: 2018-11-04 Bernd Edlinger <bernd.edlinger@hotmail.de> PR tree-optimization/87672 * gcc.dg/pr87672.c: New test. From-SVN: r265777
This commit is contained in:
parent
e237f9f31d
commit
770fe3a364
@ -1,3 +1,9 @@
|
||||
2018-11-04 Bernd Edlinger <bernd.edlinger@hotmail.de>
|
||||
|
||||
PR tree-optimization/87672
|
||||
* gimple-fold.c (gimple_fold_builtin_stxcpy_chk): Gimplify.
|
||||
* tree-ssa-strlen.c (handle_builtin_strcat): Adjust object size.
|
||||
|
||||
2018-11-04 Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
PR middle-end/58372
|
||||
|
@ -2715,6 +2715,7 @@ gimple_fold_builtin_stxcpy_chk (gimple_stmt_iterator *gsi,
|
||||
return false;
|
||||
|
||||
gimple_seq stmts = NULL;
|
||||
len = force_gimple_operand (len, &stmts, true, NULL_TREE);
|
||||
len = gimple_convert (&stmts, loc, size_type_node, len);
|
||||
len = gimple_build (&stmts, loc, PLUS_EXPR, size_type_node, len,
|
||||
build_int_cst (size_type_node, 1));
|
||||
|
@ -1,3 +1,8 @@
|
||||
2018-11-04 Bernd Edlinger <bernd.edlinger@hotmail.de>
|
||||
|
||||
PR tree-optimization/87672
|
||||
* gcc.dg/pr87672.c: New test.
|
||||
|
||||
2018-11-04 Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
PR middle-end/58372
|
||||
|
11
gcc/testsuite/gcc.dg/pr87672.c
Normal file
11
gcc/testsuite/gcc.dg/pr87672.c
Normal file
@ -0,0 +1,11 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -fdump-tree-optimized" } */
|
||||
|
||||
char buf[40];
|
||||
void test (int x)
|
||||
{
|
||||
__builtin_strcpy (buf, "test");
|
||||
__builtin___strcat_chk (buf, "postfix" + x, sizeof (buf));
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump "memcpy_chk.*, 36\\)" "optimized" } } */
|
@ -2605,12 +2605,19 @@ handle_builtin_strcat (enum built_in_function bcode, gimple_stmt_iterator *gsi)
|
||||
if (endptr)
|
||||
dst = fold_convert_loc (loc, TREE_TYPE (dst), unshare_expr (endptr));
|
||||
else
|
||||
dst = fold_build2_loc (loc, POINTER_PLUS_EXPR,
|
||||
TREE_TYPE (dst), unshare_expr (dst),
|
||||
dst = fold_build2_loc (loc, POINTER_PLUS_EXPR, TREE_TYPE (dst), dst,
|
||||
fold_convert_loc (loc, sizetype,
|
||||
unshare_expr (dstlen)));
|
||||
dst = force_gimple_operand_gsi (gsi, dst, true, NULL_TREE, true,
|
||||
GSI_SAME_STMT);
|
||||
if (objsz)
|
||||
{
|
||||
objsz = fold_build2_loc (loc, MINUS_EXPR, TREE_TYPE (objsz), objsz,
|
||||
fold_convert_loc (loc, TREE_TYPE (objsz),
|
||||
unshare_expr (dstlen)));
|
||||
objsz = force_gimple_operand_gsi (gsi, objsz, true, NULL_TREE, true,
|
||||
GSI_SAME_STMT);
|
||||
}
|
||||
if (dump_file && (dump_flags & TDF_DETAILS) != 0)
|
||||
{
|
||||
fprintf (dump_file, "Optimizing: ");
|
||||
|
Loading…
Reference in New Issue
Block a user