[Patch]: Fix very large frame bug on i386

Tristan Gingold gingold@adacore.com
Tue May 15 09:11:00 GMT 2012


Hi,

use of 'unsigned int' for i386.c:ix86_compute_frame_layout stack_alignment_needed results in truncation of frame offset in code such as:

 offset = (offset + stack_alignment_needed - 1) & -stack_alignment_needed

(as it is -stack_alignment_needed that is converted to HOST_WIDE_INT).

As a consequence, frames larger than 4GB are squeezed.

Also, the frame field of struct ix86_frame is never used.

Bootstrapped and reg-tested on x86_64 GNU/Linux, without regressions.

Ok for trunk ?

Tristan.

2012-05-15  Tristan Gingold  <gingold@adacore.com>

	* config/i386/i386.c (struct ix86_frame): Remove unused frame field.
	(ix86_compute_frame_layout): Fix type of stack_alignment_needed
	and preferred_alignment.

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index ad4739b..353ee53 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -2408,7 +2408,6 @@ struct ix86_frame
   int va_arg_size;
   int red_zone_size;
   int outgoing_arguments_size;
-  HOST_WIDE_INT frame;
 
   /* The offsets relative to ARG_POINTER.  */
   HOST_WIDE_INT frame_pointer_offset;
@@ -8937,9 +8936,9 @@ ix86_builtin_setjmp_frame_value (void)
 static void
 ix86_compute_frame_layout (struct ix86_frame *frame)
 {
-  unsigned int stack_alignment_needed;
+  unsigned HOST_WIDE_INT stack_alignment_needed;
   HOST_WIDE_INT offset;
-  unsigned int preferred_alignment;
+  unsigned HOST_WIDE_INT preferred_alignment;
   HOST_WIDE_INT size = get_frame_size ();
   HOST_WIDE_INT to_allocate;
 



More information about the Gcc-patches mailing list