mirror of
https://github.com/gcc-mirror/gcc.git
synced 2024-11-21 13:40:47 +00:00
tree-optimization/117333 - ICE with NULL access size DR
dr_may_alias_p ICEs when TYPE_SIZE of DR->ref is NULL but this is valid IL when the access size of an aggregate copy can be infered from the RHS. PR tree-optimization/117333 * tree-data-ref.cc (dr_may_alias_p): Guard against NULL access size. * gcc.dg/torture/pr117333.c: New testcase.
This commit is contained in:
parent
5e247ac0c2
commit
0e99b22aa6
29
gcc/testsuite/gcc.dg/torture/pr117333.c
Normal file
29
gcc/testsuite/gcc.dg/torture/pr117333.c
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/* { dg-do compile } */
|
||||||
|
|
||||||
|
struct s
|
||||||
|
{
|
||||||
|
unsigned long ul;
|
||||||
|
int i;
|
||||||
|
char ac[];
|
||||||
|
};
|
||||||
|
|
||||||
|
const struct s gs = { 3, -4, "abcdef" };
|
||||||
|
|
||||||
|
void copy_s(struct s*d, const struct s*s)
|
||||||
|
{
|
||||||
|
*d = *s;
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned test(struct s*ps, _Bool direct)
|
||||||
|
{
|
||||||
|
if(direct)
|
||||||
|
*ps = gs;
|
||||||
|
else
|
||||||
|
copy_s(ps, &gs);
|
||||||
|
return sizeof(*ps);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned size(void)
|
||||||
|
{
|
||||||
|
return sizeof(gs);
|
||||||
|
}
|
@ -3004,6 +3004,8 @@ dr_may_alias_p (const struct data_reference *a, const struct data_reference *b,
|
|||||||
&& DR_BASE_ADDRESS (b)
|
&& DR_BASE_ADDRESS (b)
|
||||||
&& operand_equal_p (DR_BASE_ADDRESS (a), DR_BASE_ADDRESS (b))
|
&& operand_equal_p (DR_BASE_ADDRESS (a), DR_BASE_ADDRESS (b))
|
||||||
&& operand_equal_p (DR_OFFSET (a), DR_OFFSET (b))
|
&& operand_equal_p (DR_OFFSET (a), DR_OFFSET (b))
|
||||||
|
&& tree_size_a
|
||||||
|
&& tree_size_b
|
||||||
&& poly_int_tree_p (tree_size_a)
|
&& poly_int_tree_p (tree_size_a)
|
||||||
&& poly_int_tree_p (tree_size_b)
|
&& poly_int_tree_p (tree_size_b)
|
||||||
&& !ranges_maybe_overlap_p (wi::to_poly_widest (DR_INIT (a)),
|
&& !ranges_maybe_overlap_p (wi::to_poly_widest (DR_INIT (a)),
|
||||||
|
Loading…
Reference in New Issue
Block a user