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]

fix Xtensa print_operand bug



This patch fixes a bug in the Xtensa port when there is a DFmode or
DImode memory reference with an offset of exactly 1016.  The insn is
written out as two separate single-word memory references with offsets
of 1016 and 1020.  When computing the second offset (1020), the mode
must be changed to SFmode or SImode.  A DFmode or DImode reference
with an offset of 1020 is invalid, because the second word would have
an offset of 1024 which is beyond the legal range.

This bug did not show up until I tried building glibc with gcc 3.1.
The same glibc code compiles successfully with gcc 3.0, so I assume
this counts as a 3.1 regression.  Tested with xtensa-elf target.
Patch applied on both 3.1 branch and top-of-trunk.

2002-03-22  Bob Wilson  <bob.wilson@acm.org>

	* config/xtensa/xtensa.c (print_operand): Fix incorrect mode
	passed to adjust_address.  Fix comment formatting.


cvs server: Diffing .
Index: xtensa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/xtensa/xtensa.c,v
retrieving revision 1.1.12.2
diff -c -3 -r1.1.12.2 xtensa.c
*** xtensa.c	2002/03/22 22:46:46	1.1.12.2
--- xtensa.c	2002/03/22 23:35:16
***************
*** 1926,1935 ****
        }
  
      case MEM:
!         /*
! 	 * For a volatile memory reference, emit a MEMW before the
! 	 * load or store.
! 	 */
   	if (letter == 'v')
  	  {
  	    if (MEM_VOLATILE_P (op) && TARGET_SERIALIZE_VOLATILE)
--- 1926,1933 ----
        }
  
      case MEM:
!       /* For a volatile memory reference, emit a MEMW before the
! 	 load or store.  */
   	if (letter == 'v')
  	  {
  	    if (MEM_VOLATILE_P (op) && TARGET_SERIALIZE_VOLATILE)
***************
*** 1937,1943 ****
  	    break;
  	  }
   	else if (letter == 'N')
! 	  op = adjust_address (op, GET_MODE (op), 4);
  
  	output_address (XEXP (op, 0));
  	break;
--- 1935,1950 ----
  	    break;
  	  }
   	else if (letter == 'N')
! 	  {
! 	    enum machine_mode mode;
! 	    switch (GET_MODE (op))
! 	      {
! 	      case DFmode: mode = SFmode; break;
! 	      case DImode: mode = SImode; break;
! 	      default: abort ();
! 	      }
! 	    op = adjust_address (op, mode, 4);
! 	  }
  
  	output_address (XEXP (op, 0));
  	break;

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