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 for 14700


On Mon, 2004-09-13 at 15:24, Gerald Pfeifer wrote:
> On Mon, 13 Sep 2004, Andrew MacLeod wrote:
> > 2004-09-13  Andrew MacLeod  <amacleod@redhat.com>
> >
> > 	PR tree-optimization/17400
> > 	* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Don't
> > 	coalesce partitions when one occurs in an abnormal PHI.
> 
> Please also add a testcase so that we'll never regress on that.
> (I believe the Bugzilla entry has a suitable testcase.)
> 
> The reason I'm pushing for testcases these days is that mainline is in 
> quite bad a shape, yet we seem to have surprisingly few test failures, 
> which indicates that our coverage is way too low.
> 
> Gerald

Sorry, I  meant to do just that, but it slipped what passes for my mind
:-)

Done.

2004-09-13  Andrew MacLeod  <amacleod@redhat.com>

	* g++.dg/tree-ssa/pr17400.C: New testcase.


Index: g++.dg/tree-ssa/pr17400.C
===================================================================
RCS file: g++.dg/tree-ssa/pr17400.C
diff -N g++.dg/tree-ssa/pr17400.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- g++.dg/tree-ssa/pr17400.C	13 Sep 2004 20:37:30 -0000
***************
*** 0 ****
--- 1,53 ----
+ // Test PR 17400.  Test case provided by Serge Belyshev.  
+ 
+ /* { dg-do compile } */
+ /* { dg-options "-O1" } */
+ 
+ 
+ void inc (int &);
+ bool dec_test (int &);
+ 
+ struct A
+ {
+   int c;
+   
+   friend void AddRef (A * p)
+   {
+     inc (p->c);
+   }
+   
+   friend void Release (A * p)
+   {
+     if(dec_test (p->c))
+       delete p;
+   }
+ };
+ 
+ struct B
+ {
+   B (A *p) : obj(p)
+   {
+     AddRef (obj);
+   }
+   
+   ~B()
+   {
+     Release (obj);
+   }
+   
+   void swap (B &rhs)
+   {
+     A * tmp = obj;
+     obj = rhs.obj;
+     rhs.obj = tmp;
+   }
+   
+   A *obj;
+ };
+ 
+ void bar (A *p1, A* p2)
+ {
+     B px (p1);
+     B px2 (p2);
+     px.swap (px2);
+ }



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