public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] rs6000: Fix AIX aggregate passing fix
@ 2018-12-05  0:26 Segher Boessenkool
  2018-12-13 19:27 ` David Edelsohn
  0 siblings, 1 reply; 2+ messages in thread
From: Segher Boessenkool @ 2018-12-05  0:26 UTC (permalink / raw)
  To: gcc-patches; +Cc: dje.gcc, Segher Boessenkool

David's fix for the AIX aggregate passing from yesterday unfortunately
also triggers on powerpc64-linux.  This fixes it.

David, looking at this once more, does this not need a "&& type" test
on AIX?  Before the AGGREGATE_TYPE_P test.  I suspect it only didn't
crash on AIX because AIX doesn't mind dereferencing address 0?

(But committing this as is now, it fixes bootstrap).

Tested on powerpc64-linux {-m32,-m64}.


Segher


2018-12-05  Segher Boessenkool  <segher@kernel.crashing.org>

	* config/rs6000/rs6000.c (rs6000_function_arg): Only do the special
	aggregate handling on actual AIX, not on somewhat similar systems.

---
 gcc/config/rs6000/rs6000.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 4e35a05..ea7ff82 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -11990,7 +11990,7 @@ rs6000_function_arg (cumulative_args_t cum_v, machine_mode mode,
 	cum->fregno++;
 
       if (USE_FP_FOR_ARG_P (cum, elt_mode)
-	  && !(TARGET_AIX && AGGREGATE_TYPE_P (type)))
+	  && !(TARGET_AIX && !TARGET_ELF && AGGREGATE_TYPE_P (type)))
 	{
 	  rtx rvec[GP_ARG_NUM_REG + AGGR_ARG_NUM_REG + 1];
 	  rtx r, off;
@@ -12127,7 +12127,7 @@ rs6000_arg_partial_bytes (cumulative_args_t cum_v, machine_mode mode,
   align_words = rs6000_parm_start (mode, type, cum->words);
 
   if (USE_FP_FOR_ARG_P (cum, elt_mode)
-      && !(TARGET_AIX && AGGREGATE_TYPE_P (type)))
+      && !(TARGET_AIX && !TARGET_ELF && AGGREGATE_TYPE_P (type)))
     {
       unsigned long n_fpreg = (GET_MODE_SIZE (elt_mode) + 7) >> 3;
 
-- 
1.8.3.1

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

* Re: [PATCH] rs6000: Fix AIX aggregate passing fix
  2018-12-05  0:26 [PATCH] rs6000: Fix AIX aggregate passing fix Segher Boessenkool
@ 2018-12-13 19:27 ` David Edelsohn
  0 siblings, 0 replies; 2+ messages in thread
From: David Edelsohn @ 2018-12-13 19:27 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: GCC Patches

On Tue, Dec 4, 2018 at 7:26 PM Segher Boessenkool
<segher@kernel.crashing.org> wrote:
>
> David's fix for the AIX aggregate passing from yesterday unfortunately
> also triggers on powerpc64-linux.  This fixes it.
>
> David, looking at this once more, does this not need a "&& type" test
> on AIX?  Before the AGGREGATE_TYPE_P test.  I suspect it only didn't
> crash on AIX because AIX doesn't mind dereferencing address 0?

The APIs for the functions explicitly allow type to be NULL for
libcalls, so type should be tested. AIX allows dereference of NULL
pointer, which explains the lack of symptoms on AIX.

As far as I can tell, adding a test for non-NULL type does not cause
additional incompatibilities.

I am committing the appended patch.

Bootstrapped on powerpc-ibm-aix7.2.0.0.

Thanks, David

* config/rs6000/rs6000.c (rs6000_function_arg): Ensure type is non-NULL.
(rs6000_arg_partial_bytes): Same.

Index: rs6000.c
===================================================================
--- rs6000.c    (revision 267103)
+++ rs6000.c    (working copy)
@@ -11999,7 +11999,8 @@ rs6000_function_arg (cumulative_args_t cum_v, mach
        cum->fregno++;

       if (USE_FP_FOR_ARG_P (cum, elt_mode)
-         && !(TARGET_AIX && !TARGET_ELF && AGGREGATE_TYPE_P (type)))
+         && !(TARGET_AIX && !TARGET_ELF
+              && type != NULL && AGGREGATE_TYPE_P (type)))
        {
          rtx rvec[GP_ARG_NUM_REG + AGGR_ARG_NUM_REG + 1];
          rtx r, off;
@@ -12136,7 +12137,8 @@ rs6000_arg_partial_bytes (cumulative_args_t cum_v,
   align_words = rs6000_parm_start (mode, type, cum->words);

   if (USE_FP_FOR_ARG_P (cum, elt_mode)
-      && !(TARGET_AIX && !TARGET_ELF && AGGREGATE_TYPE_P (type)))
+      && !(TARGET_AIX && !TARGET_ELF
+          && type != NULL && AGGREGATE_TYPE_P (type)))
     {
       unsigned long n_fpreg = (GET_MODE_SIZE (elt_mode) + 7) >> 3;

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

end of thread, other threads:[~2018-12-13 19:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-05  0:26 [PATCH] rs6000: Fix AIX aggregate passing fix Segher Boessenkool
2018-12-13 19:27 ` David Edelsohn

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).