[3.3 PATCH] Fix bootstrap failure on ia64-unknown-linux-gnu

Roger Sayle roger@eyesopen.com
Wed Dec 24 05:50:00 GMT 2003


The following patch restores gcc 3.3.3 (prerelease) to bootstrap land
on ia64-unknown-linux-gnu.  The failure is that convert_memory_address
is an unresolved symbol in ia64_expand_call.


Until recently, the function convert_memory_address in explow.c was
guarded by #ifdef POINTERS_EXTEND_UNSIGNED.  This required all calls
to it to also be guarded by similar conditional compilation, creating
a very ugly API.  Back in September Mark Mitchell cleaned this up, by
making the declaration of convert_memory_address unconditional, but
a no-op on targets that don't require it, which dramatically simplified
many of GCC's back-ends.  Unfortunately, this clean-up was never
backported to the release branch.


The decision to not backport the API change was an accident waiting
to happen.  Quite innocently, Zack recently backported a patch of
Steve Ellcey's from mainline that called convert_memory_address
unconditionally.  Even Zack's testing on ia64 HPUX failed to reveal
the potential problem on ia64 Linux, due to their differences in
POINTERS_EXTEND_UNSIGNED.

Rather than modify ia64_expand_call to check POINTERS_EXTEND_UNSIGNED,
the safer fix is to prevent this from happening again, and backport
Mark's API clean-up.


The following patch has been tested on ia64-unknown-linux-gnu with a
bootstrap that's survived into stage2, which it didn't previously.

Ok for the gcc-3_3-branch?


2003-12-23  Roger Sayle  <roger@eyesopen.com>

	Backport from mainline:

	2003-09-18  Mark Mitchell  <mark@codesourcery.com>
	* explow.c (convert_memory_address): Define even when
	POINTER_EXTEND_UNSIGNED is not defined.  Do nothing if the address
        is already in the right mode.


Index: explow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/explow.c,v
retrieving revision 1.104.4.1
diff -c -3 -p -r1.104.4.1 explow.c
*** explow.c	7 Apr 2003 22:58:12 -0000	1.104.4.1
--- explow.c	24 Dec 2003 00:20:24 -0000
*************** break_out_memory_refs (x)
*** 356,363 ****
    return x;
  }

- #ifdef POINTERS_EXTEND_UNSIGNED
-
  /* Given X, a memory address in ptr_mode, convert it to an address
     in Pmode, or vice versa (TO_MODE says which way).  We take advantage of
     the fact that pointers are not allowed to overflow by commuting arithmetic
--- 356,361 ----
*************** break_out_memory_refs (x)
*** 366,378 ****

  rtx
  convert_memory_address (to_mode, x)
!      enum machine_mode to_mode;
       rtx x;
  {
!   enum machine_mode from_mode = to_mode == ptr_mode ? Pmode : ptr_mode;
    rtx temp;
    enum rtx_code code;

    /* Here we handle some special cases.  If none of them apply, fall through
       to the default case.  */
    switch (GET_CODE (x))
--- 364,385 ----

  rtx
  convert_memory_address (to_mode, x)
!      enum machine_mode to_mode ATTRIBUTE_UNUSED;
       rtx x;
  {
! #ifndef POINTERS_EXTEND_UNSIGNED
!   return x;
! #else /* defined(POINTERS_EXTEND_UNSIGNED) */
!   enum machine_mode from_mode;
    rtx temp;
    enum rtx_code code;

+   /* If X already has the right mode, just return it.  */
+   if (GET_MODE (x) == to_mode)
+     return x;
+
+   from_mode = to_mode == ptr_mode ? Pmode : ptr_mode;
+
    /* Here we handle some special cases.  If none of them apply, fall through
       to the default case.  */
    switch (GET_CODE (x))
*************** convert_memory_address (to_mode, x)
*** 436,443 ****

    return convert_modes (to_mode, from_mode,
  			x, POINTERS_EXTEND_UNSIGNED);
  }
- #endif

  /* Given a memory address or facsimile X, construct a new address,
     currently equivalent, that is stable: future stores won't change it.
--- 443,450 ----

    return convert_modes (to_mode, from_mode,
  			x, POINTERS_EXTEND_UNSIGNED);
+ #endif /* defined(POINTERS_EXTEND_UNSIGNED) */
  }

  /* Given a memory address or facsimile X, construct a new address,
     currently equivalent, that is stable: future stores won't change it.


Roger
--
Roger Sayle,                         E-mail: roger@eyesopen.com
OpenEye Scientific Software,         WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833



More information about the Gcc-patches mailing list