[OBVIOUS] rs6000: fix symtab_node::get == NULL issue

Message ID 37591d69-b7c1-7a12-23b1-abb29d2183a2@suse.cz
State Committed
Headers
Series [OBVIOUS] rs6000: fix symtab_node::get == NULL issue |

Commit Message

Martin Liška Sept. 15, 2021, 3:21 p.m. UTC
  Hello.

The patch is approved by David and fixes the issue described in the PR.

Martin

	PR target/102349

gcc/ChangeLog:

	* config/rs6000/rs6000.c (rs6000_xcoff_encode_section_info):
	Check that we have a symbol summary for a symbol.
---
  gcc/config/rs6000/rs6000.c | 1 +
  1 file changed, 1 insertion(+)
  

Comments

David Edelsohn Sept. 15, 2021, 6:40 p.m. UTC | #1
This needs an additional adjustment.  The encoding decoration needs to
be applied if the decl isn't an alias.  That means both a null summary
*OR* the decl is not explicitly an alias.

I'm proposing the following:

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index d0830a95027..ad81dfb316d 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -21728,8 +21728,8 @@ rs6000_xcoff_encode_section_info (tree decl, rtx rtl, in
t first)
   if (decl
       && DECL_P (decl)
       && VAR_OR_FUNCTION_DECL_P (decl)
-      && symtab_node::get (decl) != NULL
-      && symtab_node::get (decl)->alias == 0
+      && (symtab_node::get (decl) == NULL
+         || symtab_node::get (decl)->alias == 0)
       && symname[strlen (symname) - 1] != ']')
     {
       const char *smclass = NULL;


On Wed, Sep 15, 2021 at 11:21 AM Martin Liška <mliska@suse.cz> wrote:
>
> Hello.
>
> The patch is approved by David and fixes the issue described in the PR.
>
> Martin
>
>         PR target/102349
>
> gcc/ChangeLog:
>
>         * config/rs6000/rs6000.c (rs6000_xcoff_encode_section_info):
>         Check that we have a symbol summary for a symbol.
> ---
>   gcc/config/rs6000/rs6000.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
> index b0ec8108007..d0830a95027 100644
> --- a/gcc/config/rs6000/rs6000.c
> +++ b/gcc/config/rs6000/rs6000.c
> @@ -21728,6 +21728,7 @@ rs6000_xcoff_encode_section_info (tree decl, rtx rtl, int first)
>     if (decl
>         && DECL_P (decl)
>         && VAR_OR_FUNCTION_DECL_P (decl)
> +      && symtab_node::get (decl) != NULL
>         && symtab_node::get (decl)->alias == 0
>         && symname[strlen (symname) - 1] != ']')
>       {
> --
> 2.33.0
>
  
Martin Liška Sept. 15, 2021, 7:14 p.m. UTC | #2
On 9/15/21 20:40, David Edelsohn wrote:
> This needs an additional adjustment.  The encoding decoration needs to
> be applied if the decl isn't an alias.  That means both a null summary
> *OR* the decl is not explicitly an alias.

Oh, sorry, I made a stupid thinko.

Please install the patch.
Martin

> 
> I'm proposing the following:
> 
> diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
> index d0830a95027..ad81dfb316d 100644
> --- a/gcc/config/rs6000/rs6000.c
> +++ b/gcc/config/rs6000/rs6000.c
> @@ -21728,8 +21728,8 @@ rs6000_xcoff_encode_section_info (tree decl, rtx rtl, in
> t first)
>     if (decl
>         && DECL_P (decl)
>         && VAR_OR_FUNCTION_DECL_P (decl)
> -      && symtab_node::get (decl) != NULL
> -      && symtab_node::get (decl)->alias == 0
> +      && (symtab_node::get (decl) == NULL
> +         || symtab_node::get (decl)->alias == 0)
>         && symname[strlen (symname) - 1] != ']')
>       {
>         const char *smclass = NULL;
> 
> 
> On Wed, Sep 15, 2021 at 11:21 AM Martin Liška <mliska@suse.cz> wrote:
>>
>> Hello.
>>
>> The patch is approved by David and fixes the issue described in the PR.
>>
>> Martin
>>
>>          PR target/102349
>>
>> gcc/ChangeLog:
>>
>>          * config/rs6000/rs6000.c (rs6000_xcoff_encode_section_info):
>>          Check that we have a symbol summary for a symbol.
>> ---
>>    gcc/config/rs6000/rs6000.c | 1 +
>>    1 file changed, 1 insertion(+)
>>
>> diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
>> index b0ec8108007..d0830a95027 100644
>> --- a/gcc/config/rs6000/rs6000.c
>> +++ b/gcc/config/rs6000/rs6000.c
>> @@ -21728,6 +21728,7 @@ rs6000_xcoff_encode_section_info (tree decl, rtx rtl, int first)
>>      if (decl
>>          && DECL_P (decl)
>>          && VAR_OR_FUNCTION_DECL_P (decl)
>> +      && symtab_node::get (decl) != NULL
>>          && symtab_node::get (decl)->alias == 0
>>          && symname[strlen (symname) - 1] != ']')
>>        {
>> --
>> 2.33.0
>>
  

Patch

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index b0ec8108007..d0830a95027 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -21728,6 +21728,7 @@  rs6000_xcoff_encode_section_info (tree decl, rtx rtl, int first)
    if (decl
        && DECL_P (decl)
        && VAR_OR_FUNCTION_DECL_P (decl)
+      && symtab_node::get (decl) != NULL
        && symtab_node::get (decl)->alias == 0
        && symname[strlen (symname) - 1] != ']')
      {