aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-alias.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2014-05-22 09:59:49 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2014-05-22 09:59:49 +0000
commitc8f49949668ee194ba650ef9099455099afab7cb (patch)
tree2f518f3e212c133ab8e3093440e0b6b8513289a9 /gcc/tree-ssa-alias.c
parenta822564db5c2745e4ea1394cd33aa2079baaec8d (diff)
downloadgcc-c8f49949668ee194ba650ef9099455099afab7cb.zip
gcc-c8f49949668ee194ba650ef9099455099afab7cb.tar.gz
gcc-c8f49949668ee194ba650ef9099455099afab7cb.tar.bz2
tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Handle BUILT_IN_REALLOC like BUILT_IN_STRDUP.
2014-05-22 Richard Biener <rguenther@suse.de> * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Handle BUILT_IN_REALLOC like BUILT_IN_STRDUP. (call_may_clobber_ref_p_1): Handle BUILT_IN_REALLOC as allocation and deallocation site. * tree-ssa-structalias.c (find_func_aliases_for_builtin_call): Handle BUILT_IN_REALLOC similar to BUILT_IN_STRDUP with also passing through the incoming points-to set. (handle_lhs_call): Use flags argument instead of recomputing it. (find_func_aliases_for_call): Call handle_lhs_call with proper call return flags. * gcc.dg/tree-ssa/alias-33.c: New testcase. From-SVN: r210802
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r--gcc/tree-ssa-alias.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 479fa9c..0371070 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -1594,6 +1594,7 @@ ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref)
/* These read memory pointed to by the first argument. */
case BUILT_IN_STRDUP:
case BUILT_IN_STRNDUP:
+ case BUILT_IN_REALLOC:
{
ao_ref dref;
tree size = NULL_TREE;
@@ -1991,6 +1992,15 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref)
tree ptr = gimple_call_arg (call, 0);
return ptr_deref_may_alias_ref_p_1 (ptr, ref);
}
+ /* Realloc serves both as allocation point and deallocation point. */
+ case BUILT_IN_REALLOC:
+ {
+ tree ptr = gimple_call_arg (call, 0);
+ /* Unix98 specifies that errno is set on allocation failure. */
+ return ((flag_errno_math
+ && targetm.ref_may_alias_errno (ref))
+ || ptr_deref_may_alias_ref_p_1 (ptr, ref));
+ }
case BUILT_IN_GAMMA_R:
case BUILT_IN_GAMMAF_R:
case BUILT_IN_GAMMAL_R: