tree-optimization/114246 - invalid call argument from DSE
The following makes sure to strip type conversions added by build_fold_addr_expr before placing the result in a call argument. PR tree-optimization/114246 * tree-ssa-dse.cc (increment_start_addr): Strip useless type conversions from the adjusted address. * gcc.dg/torture/pr114246.c: New testcase.
This commit is contained in:
parent
1157d5de35
commit
0249744a9f
2 changed files with 13 additions and 0 deletions
11
gcc/testsuite/gcc.dg/torture/pr114246.c
Normal file
11
gcc/testsuite/gcc.dg/torture/pr114246.c
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
/* { dg-do compile } */
|
||||||
|
/* { dg-additional-options "-w" } */
|
||||||
|
|
||||||
|
int a, b;
|
||||||
|
|
||||||
|
void
|
||||||
|
foo (void)
|
||||||
|
{
|
||||||
|
__builtin_memcpy (&a, (char *)&b - 1, 2);
|
||||||
|
__builtin_memcpy (&a, &b, 1);
|
||||||
|
}
|
|
@ -49,6 +49,7 @@ along with GCC; see the file COPYING3. If not see
|
||||||
#include "cfgloop.h"
|
#include "cfgloop.h"
|
||||||
#include "tree-data-ref.h"
|
#include "tree-data-ref.h"
|
||||||
#include "internal-fn.h"
|
#include "internal-fn.h"
|
||||||
|
#include "tree-ssa.h"
|
||||||
|
|
||||||
/* This file implements dead store elimination.
|
/* This file implements dead store elimination.
|
||||||
|
|
||||||
|
@ -658,6 +659,7 @@ increment_start_addr (gimple *stmt, tree *where, int increment)
|
||||||
*where,
|
*where,
|
||||||
build_int_cst (ptr_type_node,
|
build_int_cst (ptr_type_node,
|
||||||
increment)));
|
increment)));
|
||||||
|
STRIP_USELESS_TYPE_CONVERSION (*where);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* STMT is builtin call that writes bytes in bitmap ORIG, some bytes are dead
|
/* STMT is builtin call that writes bytes in bitmap ORIG, some bytes are dead
|
||||||
|
|
Loading…
Add table
Reference in a new issue