public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] rs6000: Skip overload instances with uninitialized fntype (PR103622)
@ 2021-12-13 16:15 Bill Schmidt
  2022-01-05 19:43 ` Bill Schmidt
  2022-01-05 20:50 ` Segher Boessenkool
  0 siblings, 2 replies; 3+ messages in thread
From: Bill Schmidt @ 2021-12-13 16:15 UTC (permalink / raw)
  To: GCC Patches; +Cc: Segher Boessenkool, David Edelsohn

Hi!

For some data types like IEEE-128, we determine whether the type is available
at built-in function initialization time.  If it's not, then we don't provide
the function type for function instances that require the data type.  PR103622
observes that this can cause us to ICE when running the list of instances when
the target doesn't support the data type.

Ideally, we wouldn't even put such an instance in the list of instances that
an overload can map to, but to do that is much more complicated.  Instead,
this patch just ensures we don't dereference a NULL pointer when the situation
arises.

Tested the fix on a powerpc-e300c3-linux-gnu cross.  Bootstrapped and tested on
powerpc64le-linux-gnu with no regressions.  Is this okay for trunk?

Thanks!
Bill


2021-12-13  Bill Schmidt  <wschmidt@linux.ibm.com>

gcc/
	PR target/103622
	* config/rs6000/rs6000-c.c (altivec_resolve_new_overloaded_builtin):
	Skip over instances with undefined function types.
---
 gcc/config/rs6000/rs6000-c.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
index 8e83d97e72f..fc4cc929884 100644
--- a/gcc/config/rs6000/rs6000-c.c
+++ b/gcc/config/rs6000/rs6000-c.c
@@ -2943,6 +2943,12 @@ altivec_resolve_new_overloaded_builtin (location_t loc, tree fndecl,
 
 	for (; instance != NULL; instance = instance->next)
 	  {
+	    /* It is possible for an instance to require a data type that isn't
+	       defined on this target, in which case instance->fntype will be
+	       NULL.  */
+	    if (!instance->fntype)
+	      continue;
+
 	    bool mismatch = false;
 	    tree nextparm = TYPE_ARG_TYPES (instance->fntype);
 
-- 
2.27.0



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rs6000: Skip overload instances with uninitialized fntype (PR103622)
  2021-12-13 16:15 [PATCH] rs6000: Skip overload instances with uninitialized fntype (PR103622) Bill Schmidt
@ 2022-01-05 19:43 ` Bill Schmidt
  2022-01-05 20:50 ` Segher Boessenkool
  1 sibling, 0 replies; 3+ messages in thread
From: Bill Schmidt @ 2022-01-05 19:43 UTC (permalink / raw)
  To: GCC Patches; +Cc: Segher Boessenkool, David Edelsohn

Hi!  I'd like to ping this patch, now that I'm back from break.

Thanks!
Bill

On 12/13/21 10:15 AM, Bill Schmidt wrote:
> Hi!
>
> For some data types like IEEE-128, we determine whether the type is available
> at built-in function initialization time.  If it's not, then we don't provide
> the function type for function instances that require the data type.  PR103622
> observes that this can cause us to ICE when running the list of instances when
> the target doesn't support the data type.
>
> Ideally, we wouldn't even put such an instance in the list of instances that
> an overload can map to, but to do that is much more complicated.  Instead,
> this patch just ensures we don't dereference a NULL pointer when the situation
> arises.
>
> Tested the fix on a powerpc-e300c3-linux-gnu cross.  Bootstrapped and tested on
> powerpc64le-linux-gnu with no regressions.  Is this okay for trunk?
>
> Thanks!
> Bill
>
>
> 2021-12-13  Bill Schmidt  <wschmidt@linux.ibm.com>
>
> gcc/
> 	PR target/103622
> 	* config/rs6000/rs6000-c.c (altivec_resolve_new_overloaded_builtin):
> 	Skip over instances with undefined function types.
> ---
>  gcc/config/rs6000/rs6000-c.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/gcc/config/rs6000/rs6000-c.c b/gcc/config/rs6000/rs6000-c.c
> index 8e83d97e72f..fc4cc929884 100644
> --- a/gcc/config/rs6000/rs6000-c.c
> +++ b/gcc/config/rs6000/rs6000-c.c
> @@ -2943,6 +2943,12 @@ altivec_resolve_new_overloaded_builtin (location_t loc, tree fndecl,
>  
>  	for (; instance != NULL; instance = instance->next)
>  	  {
> +	    /* It is possible for an instance to require a data type that isn't
> +	       defined on this target, in which case instance->fntype will be
> +	       NULL.  */
> +	    if (!instance->fntype)
> +	      continue;
> +
>  	    bool mismatch = false;
>  	    tree nextparm = TYPE_ARG_TYPES (instance->fntype);
>  

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rs6000: Skip overload instances with uninitialized fntype (PR103622)
  2021-12-13 16:15 [PATCH] rs6000: Skip overload instances with uninitialized fntype (PR103622) Bill Schmidt
  2022-01-05 19:43 ` Bill Schmidt
@ 2022-01-05 20:50 ` Segher Boessenkool
  1 sibling, 0 replies; 3+ messages in thread
From: Segher Boessenkool @ 2022-01-05 20:50 UTC (permalink / raw)
  To: Bill Schmidt; +Cc: GCC Patches, David Edelsohn

Happy new year Bill!

On Mon, Dec 13, 2021 at 10:15:46AM -0600, Bill Schmidt wrote:
> For some data types like IEEE-128, we determine whether the type is available
> at built-in function initialization time.  If it's not, then we don't provide
> the function type for function instances that require the data type.  PR103622
> observes that this can cause us to ICE when running the list of instances when
> the target doesn't support the data type.
> 
> Ideally, we wouldn't even put such an instance in the list of instances that
> an overload can map to, but to do that is much more complicated.  Instead,
> this patch just ensures we don't dereference a NULL pointer when the situation
> arises.

Okay for trunk.  Thanks!


Segher


> 	PR target/103622
> 	* config/rs6000/rs6000-c.c (altivec_resolve_new_overloaded_builtin):
> 	Skip over instances with undefined function types.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-05 20:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-13 16:15 [PATCH] rs6000: Skip overload instances with uninitialized fntype (PR103622) Bill Schmidt
2022-01-05 19:43 ` Bill Schmidt
2022-01-05 20:50 ` Segher Boessenkool

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).