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]

BIG ENDIAN bug fix for cp/decl2.c:get_guard_bits


Thu Apr  5 18:07:33 2001  J"orn Rennecke <amylaar@redhat.com>

	* decl2.c (get_guard_bits): Add big endian correction.

Index: decl2.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/cp/decl2.c,v
retrieving revision 1.471.16.1
retrieving revision 1.471.16.2
diff -p -r1.471.16.1 -r1.471.16.2
*** decl2.c	2001/01/20 07:46:37	1.471.16.1
--- decl2.c	2001/02/09 04:25:17	1.471.16.2
*************** static tree
*** 2904,2920 ****
  get_guard_bits (guard)
       tree guard;
  {
    if (!flag_new_abi)
      return guard;
  
!   /* Under the new ABI, we only set the first byte of the guard,
       in order to leave room for a mutex in the high-order bits.  */
!   guard = build1 (ADDR_EXPR, 
! 		  build_pointer_type (TREE_TYPE (guard)),
! 		  guard);
    guard = build1 (NOP_EXPR, 
  		  build_pointer_type (char_type_node), 
  		  guard);
    guard = build1 (INDIRECT_REF, char_type_node, guard);
  
    return guard;
--- 2904,2926 ----
  get_guard_bits (guard)
       tree guard;
  {
+   tree type;
+ 
    if (!flag_new_abi)
      return guard;
  
!   /* Under the new ABI, we only set the low order byte of the guard,
       in order to leave room for a mutex in the high-order bits.  */
!   type = TREE_TYPE (guard);
!   guard = build1 (ADDR_EXPR, build_pointer_type (type), guard);
    guard = build1 (NOP_EXPR, 
  		  build_pointer_type (char_type_node), 
  		  guard);
+   if (BYTES_BIG_ENDIAN)
+     guard
+       = build (PLUS_EXPR, TREE_TYPE (guard), guard,
+ 	       size_int (TREE_INT_CST_LOW (TYPE_SIZE (type))
+ 			 / BITS_PER_UNIT - 1));
    guard = build1 (INDIRECT_REF, char_type_node, guard);
  
    return guard;


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