PR gcc/84923 - gcc.dg/attr-weakref-1.c failed on aarch64

Message ID 1526020226-13904-1-git-send-email-vladimir.mezentsev@oracle.com
State New
Headers show
Series
  • PR gcc/84923 - gcc.dg/attr-weakref-1.c failed on aarch64
Related show

Commit Message

Vladimir Mezentsev May 11, 2018, 6:30 a.m.
From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>

When weakref_targets is not empty a target cannot be removed from the weak list.
A small example is below when 'wv12' is removed from the weak list on aarch64:
  static vtype Wv12 __attribute__((weakref ("wv12")));
  extern vtype wv12 __attribute__((weak));

Bootstrapped on aarch64-unknown-linux-gnu including (c,c++ and go).
Tested on aarch64-linux-gnu.
No regression. The attr-weakref-1.c test passed.

ChangeLog:
2018-05-10  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>

PR gcc/84923
* varasm.c (weak_finish): clean up weak_decls
---
 gcc/varasm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Vladimir Mezentsev May 17, 2018, 4:35 a.m. | #1
Ping.

-Vladimir


On 05/10/2018 11:30 PM, vladimir.mezentsev@oracle.com wrote:
> From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
>
> When weakref_targets is not empty a target cannot be removed from the weak list.
> A small example is below when 'wv12' is removed from the weak list on aarch64:
>   static vtype Wv12 __attribute__((weakref ("wv12")));
>   extern vtype wv12 __attribute__((weak));
>
> Bootstrapped on aarch64-unknown-linux-gnu including (c,c++ and go).
> Tested on aarch64-linux-gnu.
> No regression. The attr-weakref-1.c test passed.
>
> ChangeLog:
> 2018-05-10  Vladimir Mezentsev  <vladimir.mezentsev@oracle.com>
>
> PR gcc/84923
> * varasm.c (weak_finish): clean up weak_decls
> ---
>  gcc/varasm.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/varasm.c b/gcc/varasm.c
> index 85296b4..8cf6e1e 100644
> --- a/gcc/varasm.c
> +++ b/gcc/varasm.c
> @@ -5652,7 +5652,8 @@ weak_finish (void)
>        tree alias_decl = TREE_PURPOSE (t);
>        tree target = ultimate_transparent_alias_target (&TREE_VALUE (t));
>  
> -      if (! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (alias_decl)))
> +      if (! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (alias_decl))
> +         || TREE_SYMBOL_REFERENCED (target))
>  	/* Remove alias_decl from the weak list, but leave entries for
>  	   the target alone.  */
>  	target = NULL_TREE;
Kyrill Tkachov May 17, 2018, 8:16 a.m. | #2
Hi,

Given this is a midend change it's a good idea to CC some of the maintainers of that area.
I've copied richi and Honza.

Thanks,
Kyrill

On 17/05/18 05:35, vladimir.mezentsev@oracle.com wrote:
> Ping.
>
> -Vladimir
>
>
> On 05/10/2018 11:30 PM, vladimir.mezentsev@oracle.com wrote:
> > From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
> >
> > When weakref_targets is not empty a target cannot be removed from the weak list.
> > A small example is below when 'wv12' is removed from the weak list on aarch64:
> >   static vtype Wv12 __attribute__((weakref ("wv12")));
> >   extern vtype wv12 __attribute__((weak));
> >
> > Bootstrapped on aarch64-unknown-linux-gnu including (c,c++ and go).
> > Tested on aarch64-linux-gnu.
> > No regression. The attr-weakref-1.c test passed.
> >
> > ChangeLog:
> > 2018-05-10  Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
> >
> > PR gcc/84923
> > * varasm.c (weak_finish): clean up weak_decls
> > ---
> >  gcc/varasm.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/gcc/varasm.c b/gcc/varasm.c
> > index 85296b4..8cf6e1e 100644
> > --- a/gcc/varasm.c
> > +++ b/gcc/varasm.c
> > @@ -5652,7 +5652,8 @@ weak_finish (void)
> >        tree alias_decl = TREE_PURPOSE (t);
> >        tree target = ultimate_transparent_alias_target (&TREE_VALUE (t));
> >
> > -      if (! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (alias_decl)))
> > +      if (! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (alias_decl))
> > +         || TREE_SYMBOL_REFERENCED (target))
> >        /* Remove alias_decl from the weak list, but leave entries for
> >           the target alone.  */
> >        target = NULL_TREE;
>
Richard Biener May 17, 2018, 8:42 a.m. | #3
On Thu, 17 May 2018, Kyrill Tkachov wrote:

> Hi,
> 
> Given this is a midend change it's a good idea to CC some of the maintainers
> of that area.
> I've copied richi and Honza.

The patch is ok for trunk (it's actually mine...) and for the branch
after a while.

Thanks,
Richard.

> Thanks,
> Kyrill
> 
> On 17/05/18 05:35, vladimir.mezentsev@oracle.com wrote:
> > Ping.
> > 
> > -Vladimir
> > 
> > 
> > On 05/10/2018 11:30 PM, vladimir.mezentsev@oracle.com wrote:
> > > From: Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
> > >
> > > When weakref_targets is not empty a target cannot be removed from the weak
> > list.
> > > A small example is below when 'wv12' is removed from the weak list on
> > aarch64:
> > >   static vtype Wv12 __attribute__((weakref ("wv12")));
> > >   extern vtype wv12 __attribute__((weak));
> > >
> > > Bootstrapped on aarch64-unknown-linux-gnu including (c,c++ and go).
> > > Tested on aarch64-linux-gnu.
> > > No regression. The attr-weakref-1.c test passed.
> > >
> > > ChangeLog:
> > > 2018-05-10  Vladimir Mezentsev <vladimir.mezentsev@oracle.com>
> > >
> > > PR gcc/84923
> > > * varasm.c (weak_finish): clean up weak_decls
> > > ---
> > >  gcc/varasm.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/gcc/varasm.c b/gcc/varasm.c
> > > index 85296b4..8cf6e1e 100644
> > > --- a/gcc/varasm.c
> > > +++ b/gcc/varasm.c
> > > @@ -5652,7 +5652,8 @@ weak_finish (void)
> > >        tree alias_decl = TREE_PURPOSE (t);
> > >        tree target = ultimate_transparent_alias_target (&TREE_VALUE (t));
> > >
> > > -      if (! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (alias_decl)))
> > > +      if (! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (alias_decl))
> > > +         || TREE_SYMBOL_REFERENCED (target))
> > >        /* Remove alias_decl from the weak list, but leave entries for
> > >           the target alone.  */
> > >        target = NULL_TREE;
> > 
> 
>
Jeff Law May 21, 2018, 8:30 p.m. | #4
On 05/17/2018 02:42 AM, Richard Biener wrote:
> On Thu, 17 May 2018, Kyrill Tkachov wrote:
> 
>> Hi,
>>
>> Given this is a midend change it's a good idea to CC some of the maintainers
>> of that area.
>> I've copied richi and Honza.
> 
> The patch is ok for trunk (it's actually mine...) and for the branch
> after a while.
Installed.

Vladimir -- do you have write access?  ISTM it would make sense for you
to have access if you plan to continue submitting changes.

Jeff
Vladimir Mezentsev May 21, 2018, 10:12 p.m. | #5
On 05/21/2018 01:30 PM, Jeff Law wrote:
> On 05/17/2018 02:42 AM, Richard Biener wrote:
>> On Thu, 17 May 2018, Kyrill Tkachov wrote:
>>
>>> Hi,
>>>
>>> Given this is a midend change it's a good idea to CC some of the maintainers
>>> of that area.
>>> I've copied richi and Honza.
>> The patch is ok for trunk (it's actually mine...) and for the branch
>> after a while.
> Installed.
>
> Vladimir -- do you have write access?  
  No. I don't.

> ISTM it would make sense for you
> to have access if you plan to continue submitting changes.

yes. I plan to continue submitting changes.

-Vladimir

>
> Jeff

Patch

diff --git a/gcc/varasm.c b/gcc/varasm.c
index 85296b4..8cf6e1e 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -5652,7 +5652,8 @@  weak_finish (void)
       tree alias_decl = TREE_PURPOSE (t);
       tree target = ultimate_transparent_alias_target (&TREE_VALUE (t));
 
-      if (! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (alias_decl)))
+      if (! TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (alias_decl))
+         || TREE_SYMBOL_REFERENCED (target))
 	/* Remove alias_decl from the weak list, but leave entries for
 	   the target alone.  */
 	target = NULL_TREE;