This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

powerpc -p segfaults cc1


I tried to send this email yesterday, but looks like bigpond is still
dropping email.  Apologies if it appears twice.

Geoff's 2003-10-07 commit broke powerpc-linux and powerpc64-linux
profiling.  "gcc -c -p" on the following testcase crashes cc1 inside
final.c:profile_function.

typedef struct { int a; int b; } a_t;
a_t f (void) { return (a_t) {0,0}; }

The problem is that rs6000/sysv4.h defines ASM_OUTPUT_REG_PUSH in order
to save the static chain, but targetm.calls.struct_value_rtx returns
NULL (which is correct for these targets).

	* final.c (profile_function): Allow for NULL svrtx.

Bootstrapped, etc.  OK mainline?

diff -urp gcc-current/gcc/final.c gcc-ppc64-34/gcc/final.c
--- gcc-current/gcc/final.c	2003-10-21 12:30:54.000000000 +0930
+++ gcc-ppc64-34/gcc/final.c	2003-10-27 22:54:04.000000000 +1030
@@ -1437,7 +1437,7 @@ profile_function (FILE *file ATTRIBUTE_U
   function_section (current_function_decl);
 
 #if defined(ASM_OUTPUT_REG_PUSH)
-  if (sval && GET_CODE (svrtx) == REG)
+  if (sval && svrtx != NULL && GET_CODE (svrtx) == REG)
     ASM_OUTPUT_REG_PUSH (file, REGNO (svrtx));
 #endif
 
@@ -1468,7 +1468,7 @@ profile_function (FILE *file ATTRIBUTE_U
 #endif
 
 #if defined(ASM_OUTPUT_REG_PUSH)
-  if (sval && GET_CODE (svrtx) == REG)
+  if (sval && svrtx != NULL && GET_CODE (svrtx) == REG)
     ASM_OUTPUT_REG_POP (file, REGNO (svrtx));
 #endif
 }

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]