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]

[Tru64 PATCH] PR target/22223: .frame vs. large stack frames


The following patch resolves PR target/22223 which is the failure of
the testcase gcc.c-torture/compile/20050622-1.c on alphaev67-dec-osf5.1,
which according to the PR's date has been failing since it was added.
The issue is that the 72 Mbyte stack frame in this testcase triggers
a limitation of the native assembler which is unable to handle the
.frame directive to generate debugging information for stack frames
larger than 512 Kbytes.  Hence the fatal error message:

as1: Error: /tmp//cciTXuV1.s, line 1: register save offset must be less .5
megabytes

The simple patch below corrects the alpha backend's existing threshold
above which it doesn't generate full .frame and .mask directives.
This is currently 2^31 bytes, but on Tru64 when not using gas, we now
lower this to 512K.  This restriction is less severe than it may seem,
as gdb has never worked well on this platform (breakpoints trigger
segmentation faults); so I've never seen a Tru64 stack trace let alone
one with a large frame :-)

The patch below has been tested on alphaev67-dec-osf5.1, with a bootstrap
of the C language, and regression tested with "make -k check-gcc" in the
gcc directory where it has no new regressions, and resolves six
unexpected failures.  As Rainer is currently on vacation, I'll retest
both this and my previous alpha patch bootstrapping more languages, but
building java is currently broken on mainline (compiler ICE).

Ok for mainline?

Thanks in advance,


2006-09-01  Roger Sayle  <roger@eyesopen.com>

	PR target/22223
	* config/alpha/alpha.c (alpha_start_function): Don't emit stack
	frame information for frames larger than 512 Kbytes on Tru64 when
	using the native assembler.


Index: config/alpha/alpha.c
===================================================================
*** config/alpha/alpha.c	(revision 116415)
--- config/alpha/alpha.c	(working copy)
*************** alpha_start_function (FILE *file, const
*** 7836,7841 ****
--- 7836,7845 ----
    HOST_WIDE_INT sa_size;
    /* Complete stack size needed.  */
    unsigned HOST_WIDE_INT frame_size;
+   /* The maximum debuggable frame size (512 Kbytes using Tru64 as).  */
+   unsigned HOST_WIDE_INT max_frame_size = TARGET_ABI_OSF && !TARGET_GAS
+ 					  ? 524288
+ 					  : 1UL << 31;
    /* Offset from base reg to register save area.  */
    HOST_WIDE_INT reg_offset;
    char *entry_label = (char *) alloca (strlen (fnname) + 6);
*************** alpha_start_function (FILE *file, const
*** 7960,7966 ****
      fprintf (file, "\t.frame $%d," HOST_WIDE_INT_PRINT_DEC ",$26,%d\n",
  	     (frame_pointer_needed
  	      ? HARD_FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM),
! 	     frame_size >= (1UL << 31) ? 0 : frame_size,
  	     current_function_pretend_args_size);

    /* Describe which registers were spilled.  */
--- 7964,7970 ----
      fprintf (file, "\t.frame $%d," HOST_WIDE_INT_PRINT_DEC ",$26,%d\n",
  	     (frame_pointer_needed
  	      ? HARD_FRAME_POINTER_REGNUM : STACK_POINTER_REGNUM),
! 	     frame_size >= max_frame_size ? 0 : frame_size,
  	     current_function_pretend_args_size);

    /* Describe which registers were spilled.  */
*************** alpha_start_function (FILE *file, const
*** 7982,7988 ****
        if (imask)
  	{
  	  fprintf (file, "\t.mask 0x%lx," HOST_WIDE_INT_PRINT_DEC "\n", imask,
! 		   frame_size >= (1UL << 31) ? 0 : reg_offset - frame_size);

  	  for (i = 0; i < 32; ++i)
  	    if (imask & (1UL << i))
--- 7986,7992 ----
        if (imask)
  	{
  	  fprintf (file, "\t.mask 0x%lx," HOST_WIDE_INT_PRINT_DEC "\n", imask,
! 		   frame_size >= max_frame_size ? 0 : reg_offset - frame_size);

  	  for (i = 0; i < 32; ++i)
  	    if (imask & (1UL << i))
*************** alpha_start_function (FILE *file, const
*** 7991,7997 ****

        if (fmask)
  	fprintf (file, "\t.fmask 0x%lx," HOST_WIDE_INT_PRINT_DEC "\n", fmask,
! 		 frame_size >= (1UL << 31) ? 0 : reg_offset - frame_size);
      }

  #if TARGET_ABI_OPEN_VMS
--- 7995,8001 ----

        if (fmask)
  	fprintf (file, "\t.fmask 0x%lx," HOST_WIDE_INT_PRINT_DEC "\n", fmask,
! 		 frame_size >= max_frame_size ? 0 : reg_offset - frame_size);
      }

  #if TARGET_ABI_OPEN_VMS


Roger
--


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