Commit 604d0dbc by Richard Guenther Committed by Richard Biener

re PR tree-optimization/42944 (errno misoptimization around malloc call)

2010-02-19  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42944
	* tree-ssa-alias.c (call_may_clobber_ref_p_1): Massage
	test for aliasing with errno.

From-SVN: r156890
parent 40e90eac
2010-02-19 Richard Guenther <rguenther@suse.de>
PR tree-optimization/42944
* tree-ssa-alias.c (call_may_clobber_ref_p_1): Massage
test for aliasing with errno.
2010-02-19 Jakub Jelinek <jakub@redhat.com> 2010-02-19 Jakub Jelinek <jakub@redhat.com>
PR middle-end/42233 PR middle-end/42233
......
...@@ -1258,16 +1258,19 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref) ...@@ -1258,16 +1258,19 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref)
case BUILT_IN_CALLOC: case BUILT_IN_CALLOC:
/* Unix98 specifies that errno is set on allocation failure. /* Unix98 specifies that errno is set on allocation failure.
Until we properly can track the errno location assume it Until we properly can track the errno location assume it
is not a plain decl but anonymous storage in a different is not a local decl but external or anonymous storage in
translation unit. */ a different translation unit. Also assume it is of
if (flag_errno_math) type int as required by the standard. */
if (flag_errno_math
&& TREE_TYPE (base) == integer_type_node)
{ {
struct ptr_info_def *pi; struct ptr_info_def *pi;
if (DECL_P (base)) if (DECL_P (base)
return false; && !TREE_STATIC (base))
if (INDIRECT_REF_P (base) return true;
&& TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME else if (INDIRECT_REF_P (base)
&& (pi = SSA_NAME_PTR_INFO (TREE_OPERAND (base, 0)))) && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME
&& (pi = SSA_NAME_PTR_INFO (TREE_OPERAND (base, 0))))
return pi->pt.anything || pi->pt.nonlocal; return pi->pt.anything || pi->pt.nonlocal;
} }
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment