re PR tree-optimization/56210 (invalid -Warray-bounds warning)
2013-03-18 Richard Biener <rguenther@suse.de> PR tree-optimization/56210 * tree-ssa-structalias.c (find_func_aliases_for_builtin_call): Handle string / character search functions. * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Likewise. From-SVN: r196777
This commit is contained in:
parent
31348d52c0
commit
92608d0edb
|
@ -1,3 +1,10 @@
|
||||||
|
2013-03-18 Richard Biener <rguenther@suse.de>
|
||||||
|
|
||||||
|
PR tree-optimization/56210
|
||||||
|
* tree-ssa-structalias.c (find_func_aliases_for_builtin_call):
|
||||||
|
Handle string / character search functions.
|
||||||
|
* tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Likewise.
|
||||||
|
|
||||||
2013-03-18 Richard Biener <rguenther@suse.de>
|
2013-03-18 Richard Biener <rguenther@suse.de>
|
||||||
|
|
||||||
PR middle-end/56483
|
PR middle-end/56483
|
||||||
|
|
|
@ -1314,6 +1314,43 @@ ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref)
|
||||||
size);
|
size);
|
||||||
return refs_may_alias_p_1 (&dref, ref, false);
|
return refs_may_alias_p_1 (&dref, ref, false);
|
||||||
}
|
}
|
||||||
|
/* These read memory pointed to by the first argument. */
|
||||||
|
case BUILT_IN_INDEX:
|
||||||
|
case BUILT_IN_STRCHR:
|
||||||
|
case BUILT_IN_STRRCHR:
|
||||||
|
{
|
||||||
|
ao_ref dref;
|
||||||
|
ao_ref_init_from_ptr_and_size (&dref,
|
||||||
|
gimple_call_arg (call, 0),
|
||||||
|
NULL_TREE);
|
||||||
|
return refs_may_alias_p_1 (&dref, ref, false);
|
||||||
|
}
|
||||||
|
/* These read memory pointed to by the first argument with size
|
||||||
|
in the third argument. */
|
||||||
|
case BUILT_IN_MEMCHR:
|
||||||
|
{
|
||||||
|
ao_ref dref;
|
||||||
|
ao_ref_init_from_ptr_and_size (&dref,
|
||||||
|
gimple_call_arg (call, 0),
|
||||||
|
gimple_call_arg (call, 2));
|
||||||
|
return refs_may_alias_p_1 (&dref, ref, false);
|
||||||
|
}
|
||||||
|
/* These read memory pointed to by the first and second arguments. */
|
||||||
|
case BUILT_IN_STRSTR:
|
||||||
|
case BUILT_IN_STRPBRK:
|
||||||
|
{
|
||||||
|
ao_ref dref;
|
||||||
|
ao_ref_init_from_ptr_and_size (&dref,
|
||||||
|
gimple_call_arg (call, 0),
|
||||||
|
NULL_TREE);
|
||||||
|
if (refs_may_alias_p_1 (&dref, ref, false))
|
||||||
|
return true;
|
||||||
|
ao_ref_init_from_ptr_and_size (&dref,
|
||||||
|
gimple_call_arg (call, 1),
|
||||||
|
NULL_TREE);
|
||||||
|
return refs_may_alias_p_1 (&dref, ref, false);
|
||||||
|
}
|
||||||
|
|
||||||
/* The following builtins do not read from memory. */
|
/* The following builtins do not read from memory. */
|
||||||
case BUILT_IN_FREE:
|
case BUILT_IN_FREE:
|
||||||
case BUILT_IN_MALLOC:
|
case BUILT_IN_MALLOC:
|
||||||
|
|
|
@ -4196,6 +4196,29 @@ find_func_aliases_for_builtin_call (gimple t)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
/* String / character search functions return a pointer into the
|
||||||
|
source string or NULL. */
|
||||||
|
case BUILT_IN_INDEX:
|
||||||
|
case BUILT_IN_STRCHR:
|
||||||
|
case BUILT_IN_STRRCHR:
|
||||||
|
case BUILT_IN_MEMCHR:
|
||||||
|
case BUILT_IN_STRSTR:
|
||||||
|
case BUILT_IN_STRPBRK:
|
||||||
|
if (gimple_call_lhs (t))
|
||||||
|
{
|
||||||
|
tree src = gimple_call_arg (t, 0);
|
||||||
|
get_constraint_for_ptr_offset (src, NULL_TREE, &rhsc);
|
||||||
|
constraint_expr nul;
|
||||||
|
nul.var = nothing_id;
|
||||||
|
nul.offset = 0;
|
||||||
|
nul.type = ADDRESSOF;
|
||||||
|
rhsc.safe_push (nul);
|
||||||
|
get_constraint_for (gimple_call_lhs (t), &lhsc);
|
||||||
|
process_all_all_constraints (lhsc, rhsc);
|
||||||
|
lhsc.release();
|
||||||
|
rhsc.release();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
/* Trampolines are special - they set up passing the static
|
/* Trampolines are special - they set up passing the static
|
||||||
frame. */
|
frame. */
|
||||||
case BUILT_IN_INIT_TRAMPOLINE:
|
case BUILT_IN_INIT_TRAMPOLINE:
|
||||||
|
|
Loading…
Reference in New Issue