This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR42944


On Tue, 16 Feb 2010, Steve Ellcey wrote:

> > We're a bit overeager in assuming that malloc/calloc do not clobber
> > memory.  Because glibc appearantly chooses to set errno.
> > 
> > Fixed as follows, bootstrapped and tested on x86_64-unknown-linux-gnu.
> > 
> > The testcase will show whether there are any systems that have
> > a plain errno declaration.
> 
> And then what?  The test case is failing for me on my HP-UX systems.

Then we'll massage the test until everyone is happy.  Does the
following make it work for you?

Thanks,
Richard.

2010-02-17  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.

Index: gcc/tree-ssa-alias.c
===================================================================
--- gcc/tree-ssa-alias.c	(revision 156824)
+++ gcc/tree-ssa-alias.c	(working copy)
@@ -1260,14 +1260,16 @@ call_may_clobber_ref_p_1 (gimple call, a
 	     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)
+	  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;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]