diff mbox

[PR,61211] Fix a bug in clone_of_p verification

Message ID 20140530224603.GA23341@virgil.suse
State New
Headers show

Commit Message

Martin Jambor May 30, 2014, 10:46 p.m. UTC
Hi,

after a clone is materialized, its clone_of field is cleared which in
PR 61211 leads to a failure in the skipped_thunk path in clone_of_p in
cgraph.c, which then leads to a false positive verification failure.

Fixed by the following patch.  Bootstrapped and tested on x86_64-linux
on both the trunk and the 4.9 branch.  OK for both?

Thanks,

Martin


2014-05-30  Martin Jambor  <mjambor@suse.cz>

	PR ipa/61211
	* cgraph.c (clone_of_p): Allow skipped_branch to deal with
	expanded clones.

Comments

Martin Jambor June 17, 2014, 6:56 p.m. UTC | #1
Ping.

Thanks,

Martin


On Sat, May 31, 2014 at 12:46:03AM +0200, Martin Jambor wrote:
> Hi,
> 
> after a clone is materialized, its clone_of field is cleared which in
> PR 61211 leads to a failure in the skipped_thunk path in clone_of_p in
> cgraph.c, which then leads to a false positive verification failure.
> 
> Fixed by the following patch.  Bootstrapped and tested on x86_64-linux
> on both the trunk and the 4.9 branch.  OK for both?
> 
> Thanks,
> 
> Martin
> 
> 
> 2014-05-30  Martin Jambor  <mjambor@suse.cz>
> 
> 	PR ipa/61211
> 	* cgraph.c (clone_of_p): Allow skipped_branch to deal with
> 	expanded clones.
> 
> diff --git a/gcc/cgraph.c b/gcc/cgraph.c
> index ff65b86..f18f977 100644
> --- a/gcc/cgraph.c
> +++ b/gcc/cgraph.c
> @@ -2566,11 +2566,16 @@ clone_of_p (struct cgraph_node *node, struct cgraph_node *node2)
>        skipped_thunk = true;
>      }
>  
> -  if (skipped_thunk
> -      && (!node2->clone_of
> -	  || !node2->clone.args_to_skip
> -	  || !bitmap_bit_p (node2->clone.args_to_skip, 0)))
> -    return false;
> +  if (skipped_thunk)
> +    {
> +      if (!node2->clone.args_to_skip
> +	  || !bitmap_bit_p (node2->clone.args_to_skip, 0))
> +	return false;
> +      if (node2->former_clone_of == node->decl)
> +	return true;
> +      else if (!node2->clone_of)
> +	return false;
> +    }
>  
>    while (node != node2 && node2)
>      node2 = node2->clone_of;
Jan Hubicka June 20, 2014, 5:06 a.m. UTC | #2
> Ping.
> 
> Thanks,
> 
> Martin
> 
> 
> On Sat, May 31, 2014 at 12:46:03AM +0200, Martin Jambor wrote:
> > Hi,
> > 
> > after a clone is materialized, its clone_of field is cleared which in
> > PR 61211 leads to a failure in the skipped_thunk path in clone_of_p in
> > cgraph.c, which then leads to a false positive verification failure.
> > 
> > Fixed by the following patch.  Bootstrapped and tested on x86_64-linux
> > on both the trunk and the 4.9 branch.  OK for both?
> > 
> > Thanks,
> > 
> > Martin
> > 
> > 
> > 2014-05-30  Martin Jambor  <mjambor@suse.cz>
> > 
> > 	PR ipa/61211
> > 	* cgraph.c (clone_of_p): Allow skipped_branch to deal with
> > 	expanded clones.

OK, thanks!
Honza
> > 
> > diff --git a/gcc/cgraph.c b/gcc/cgraph.c
> > index ff65b86..f18f977 100644
> > --- a/gcc/cgraph.c
> > +++ b/gcc/cgraph.c
> > @@ -2566,11 +2566,16 @@ clone_of_p (struct cgraph_node *node, struct cgraph_node *node2)
> >        skipped_thunk = true;
> >      }
> >  
> > -  if (skipped_thunk
> > -      && (!node2->clone_of
> > -	  || !node2->clone.args_to_skip
> > -	  || !bitmap_bit_p (node2->clone.args_to_skip, 0)))
> > -    return false;
> > +  if (skipped_thunk)
> > +    {
> > +      if (!node2->clone.args_to_skip
> > +	  || !bitmap_bit_p (node2->clone.args_to_skip, 0))
> > +	return false;
> > +      if (node2->former_clone_of == node->decl)
> > +	return true;
> > +      else if (!node2->clone_of)
> > +	return false;
> > +    }
> >  
> >    while (node != node2 && node2)
> >      node2 = node2->clone_of;
diff mbox

Patch

diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index ff65b86..f18f977 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -2566,11 +2566,16 @@  clone_of_p (struct cgraph_node *node, struct cgraph_node *node2)
       skipped_thunk = true;
     }
 
-  if (skipped_thunk
-      && (!node2->clone_of
-	  || !node2->clone.args_to_skip
-	  || !bitmap_bit_p (node2->clone.args_to_skip, 0)))
-    return false;
+  if (skipped_thunk)
+    {
+      if (!node2->clone.args_to_skip
+	  || !bitmap_bit_p (node2->clone.args_to_skip, 0))
+	return false;
+      if (node2->former_clone_of == node->decl)
+	return true;
+      else if (!node2->clone_of)
+	return false;
+    }
 
   while (node != node2 && node2)
     node2 = node2->clone_of;