You can easily get -fcompare-debug failures on AIX with small functions, in 
fact you get the failure for the empty function:

void foo (void) {}

eric@polaris:~/build/gcc/powerpc-ibm-aix7.1> gcc/xgcc -Bgcc -S t.c -O -
fcompare-debug
xgcc: error: t.c: -fcompare-debug failure (length)

Fixed thusly, tested on powerpc-ibm-aix7.1, OK for the mainline?


2015-04-29  Eric Botcazou  <ebotca...@adacore.com>

        * config/rs6000/rs6000.c (rs6000_stack_info): For XCOFF, replace test
        on debug info with test on optimization to decide stack pushing.


2015-04-29  Eric Botcazou  <ebotca...@adacore.com>

        * gcc.dg/empty3.c: New test.


-- 
Eric Botcazou
Index: config/rs6000/rs6000.c
===================================================================
--- config/rs6000/rs6000.c	(revision 222439)
+++ config/rs6000/rs6000.c	(working copy)
@@ -21932,8 +21932,8 @@ rs6000_stack_info (void)
   /* Determine if we need to allocate any stack frame:
 
      For AIX we need to push the stack if a frame pointer is needed
-     (because the stack might be dynamically adjusted), if we are
-     debugging, if we make calls, or if the sum of fp_save, gp_save,
+     (because the stack might be dynamically adjusted), if we are not
+     optimizing, if we make calls, or if the sum of fp_save, gp_save,
      and local variables are more than the space needed to save all
      non-volatile registers: 32-bit: 18*8 + 19*4 = 220 or 64-bit: 18*8
      + 18*8 = 288 (GPR13 reserved).
@@ -21950,7 +21950,7 @@ rs6000_stack_info (void)
   else if (frame_pointer_needed)
     info_ptr->push_p = 1;
 
-  else if (TARGET_XCOFF && write_symbols != NO_DEBUG)
+  else if (TARGET_XCOFF && !optimize)
     info_ptr->push_p = 1;
 
   else
/* { dg-options "-O -fcompare-debug" } */

void foo (void) {}

Reply via email to