* [PATCH] rs6000: Skip overload instances with NULL fntype [PR104967]
@ 2022-03-23 9:33 Kewen.Lin
2022-03-23 12:29 ` David Edelsohn
2022-03-23 14:29 ` Paul A. Clarke
0 siblings, 2 replies; 4+ messages in thread
From: Kewen.Lin @ 2022-03-23 9:33 UTC (permalink / raw)
To: GCC Patches; +Cc: Segher Boessenkool, David Edelsohn, Peter Bergner
Hi,
As shown in PR104967, for some overload built-in function instance,
if it requires a date type which isn't defined on the target, its
fntype would be initialized as NULL. This patch is to consider
this possibility in function find_instance to avoid ICE.
Bootstrapped and regtested on powerpc64-linux-gnu P8 and
powerpc64le-linux-gnu P9 and P10.
Is it ok for trunk?
BR,
Kewen
PR target/104967
gcc/ChangeLog:
* config/rs6000/rs6000-c.cc (find_instance): Skip instances with null
function types.
---
gcc/config/rs6000/rs6000-c.cc | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc
index 15251efc209..b0f9fce4b54 100644
--- a/gcc/config/rs6000/rs6000-c.cc
+++ b/gcc/config/rs6000/rs6000-c.cc
@@ -1678,6 +1678,10 @@ find_instance (bool *unsupported_builtin, ovlddata **instance,
ovlddata *inst = *instance;
gcc_assert (inst != NULL);
+ /* It is possible for an instance to require a data type that isn't
+ defined on this target, in which case inst->fntype will be NULL. */
+ if (!inst->fntype)
+ return error_mark_node;
tree fntype = rs6000_builtin_info[inst->bifid].fntype;
tree parmtype0 = TREE_VALUE (TYPE_ARG_TYPES (fntype));
tree parmtype1 = TREE_VALUE (TREE_CHAIN (TYPE_ARG_TYPES (fntype)));
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rs6000: Skip overload instances with NULL fntype [PR104967]
2022-03-23 9:33 [PATCH] rs6000: Skip overload instances with NULL fntype [PR104967] Kewen.Lin
@ 2022-03-23 12:29 ` David Edelsohn
2022-03-24 1:52 ` Kewen.Lin
2022-03-23 14:29 ` Paul A. Clarke
1 sibling, 1 reply; 4+ messages in thread
From: David Edelsohn @ 2022-03-23 12:29 UTC (permalink / raw)
To: Kewen.Lin; +Cc: GCC Patches, Segher Boessenkool, Peter Bergner
On Wed, Mar 23, 2022 at 5:33 AM Kewen.Lin <linkw@linux.ibm.com> wrote:
>
> Hi,
>
> As shown in PR104967, for some overload built-in function instance,
> if it requires a date type which isn't defined on the target, its
> fntype would be initialized as NULL. This patch is to consider
> this possibility in function find_instance to avoid ICE.
>
> Bootstrapped and regtested on powerpc64-linux-gnu P8 and
> powerpc64le-linux-gnu P9 and P10.
>
> Is it ok for trunk?
Okay.
Thanks, David
>
> BR,
> Kewen
>
> PR target/104967
>
> gcc/ChangeLog:
>
> * config/rs6000/rs6000-c.cc (find_instance): Skip instances with null
> function types.
>
> ---
> gcc/config/rs6000/rs6000-c.cc | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc
> index 15251efc209..b0f9fce4b54 100644
> --- a/gcc/config/rs6000/rs6000-c.cc
> +++ b/gcc/config/rs6000/rs6000-c.cc
> @@ -1678,6 +1678,10 @@ find_instance (bool *unsupported_builtin, ovlddata **instance,
>
> ovlddata *inst = *instance;
> gcc_assert (inst != NULL);
> + /* It is possible for an instance to require a data type that isn't
> + defined on this target, in which case inst->fntype will be NULL. */
> + if (!inst->fntype)
> + return error_mark_node;
> tree fntype = rs6000_builtin_info[inst->bifid].fntype;
> tree parmtype0 = TREE_VALUE (TYPE_ARG_TYPES (fntype));
> tree parmtype1 = TREE_VALUE (TREE_CHAIN (TYPE_ARG_TYPES (fntype)));
> --
> 2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rs6000: Skip overload instances with NULL fntype [PR104967]
2022-03-23 9:33 [PATCH] rs6000: Skip overload instances with NULL fntype [PR104967] Kewen.Lin
2022-03-23 12:29 ` David Edelsohn
@ 2022-03-23 14:29 ` Paul A. Clarke
1 sibling, 0 replies; 4+ messages in thread
From: Paul A. Clarke @ 2022-03-23 14:29 UTC (permalink / raw)
To: Kewen.Lin; +Cc: GCC Patches, Peter Bergner, David Edelsohn, Segher Boessenkool
On Wed, Mar 23, 2022 at 05:33:21PM +0800, Kewen.Lin via Gcc-patches wrote:
> As shown in PR104967, for some overload built-in function instance,
> if it requires a date type which isn't defined on the target, its
nit: s/date/data/
> fntype would be initialized as NULL. This patch is to consider
> this possibility in function find_instance to avoid ICE.
PC
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] rs6000: Skip overload instances with NULL fntype [PR104967]
2022-03-23 12:29 ` David Edelsohn
@ 2022-03-24 1:52 ` Kewen.Lin
0 siblings, 0 replies; 4+ messages in thread
From: Kewen.Lin @ 2022-03-24 1:52 UTC (permalink / raw)
To: David Edelsohn, Paul A. Clarke
Cc: GCC Patches, Segher Boessenkool, Peter Bergner
on 2022/3/23 8:29 PM, David Edelsohn wrote:
> On Wed, Mar 23, 2022 at 5:33 AM Kewen.Lin <linkw@linux.ibm.com> wrote:
>>
>> Hi,
>>
>> As shown in PR104967, for some overload built-in function instance,
>> if it requires a date type which isn't defined on the target, its
>> fntype would be initialized as NULL. This patch is to consider
>> this possibility in function find_instance to avoid ICE.
>>
>> Bootstrapped and regtested on powerpc64-linux-gnu P8 and
>> powerpc64le-linux-gnu P9 and P10.
>>
>> Is it ok for trunk?
>
> Okay.
>
> Thanks, David
>
Thanks David! Committed as r12-7792-g497bde3ab92b2c.
>> As shown in PR104967, for some overload built-in function instance,
>> if it requires a date type which isn't defined on the target, its
> nit: s/date/data/
>
Thanks for catching Paul! Updated in pushed commit log.
BR,
Kewen
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-24 1:52 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-23 9:33 [PATCH] rs6000: Skip overload instances with NULL fntype [PR104967] Kewen.Lin
2022-03-23 12:29 ` David Edelsohn
2022-03-24 1:52 ` Kewen.Lin
2022-03-23 14:29 ` Paul A. Clarke
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).