diff options
author | Richard Guenther <rguenther@suse.de> | 2010-02-19 10:40:17 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2010-02-19 10:40:17 +0000 |
commit | 604d0dbc8b8318a44e49f90d97293fa9e806666a (patch) | |
tree | 8f4159aeaa712c9acbb01ecab4492da1751f83bc | |
parent | 40e90eac9591b388ab335cac5f793906cc9a5b0a (diff) | |
download | gcc-604d0dbc8b8318a44e49f90d97293fa9e806666a.zip gcc-604d0dbc8b8318a44e49f90d97293fa9e806666a.tar.gz gcc-604d0dbc8b8318a44e49f90d97293fa9e806666a.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/tree-ssa-alias.c | 19 |
2 files changed, 17 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 17f72d9..607c318 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +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> PR middle-end/42233 diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 7b60201..b235ecc 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -1258,16 +1258,19 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref) case BUILT_IN_CALLOC: /* Unix98 specifies that errno is set on allocation failure. Until we properly can track the errno location assume it - is not a plain decl but anonymous storage in a different - translation unit. */ - if (flag_errno_math) + is not a local decl but external or anonymous storage in + a different translation unit. Also assume it is of + type int as required by the standard. */ + if (flag_errno_math + && TREE_TYPE (base) == integer_type_node) { struct ptr_info_def *pi; - if (DECL_P (base)) - return false; - if (INDIRECT_REF_P (base) - && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME - && (pi = SSA_NAME_PTR_INFO (TREE_OPERAND (base, 0)))) + if (DECL_P (base) + && !TREE_STATIC (base)) + return true; + else if (INDIRECT_REF_P (base) + && 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 false; |