FUNCTION_BOUNDARY and FUNCTION_TYPE

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Fri Mar 5 03:32:00 GMT 2004


We seem to use POINTER_SIZE*2 as the size for an object of 
FUNCTION_TYPE. This seems bizarre, but there really isn't a meaning
for such a size.  However, it seems clear that TYPE_ALIGN of such
a type should be FUNCTION_BOUNDARY, but the existing code also
sets it to POINTER_SIZE*2, which seems wrong.

Is the following likely to be correct?

*** stor-layout.c	26 Feb 2004 23:41:34 -0000	1.178
--- stor-layout.c	5 Mar 2004 03:29:47 -0000
*************** layout_type (tree type)
*** 1583,1589 ****
      case FUNCTION_TYPE:
      case METHOD_TYPE:
!       TYPE_MODE (type) = mode_for_size (2 * POINTER_SIZE, MODE_INT, 0);
!       TYPE_SIZE (type) = bitsize_int (2 * POINTER_SIZE);
!       TYPE_SIZE_UNIT (type) = size_int ((2 * POINTER_SIZE) / BITS_PER_UNIT);
        break;
  
--- 1583,1592 ----
      case FUNCTION_TYPE:
      case METHOD_TYPE:
!       /* It's hard to see what the mode and size of a function ought to
! 	 be, but we do know the alignment is FUNCTION_BOUNDARY, so
! 	 make it consistent with that.  */
!       TYPE_MODE (type) = mode_for_size (FUNCTION_BOUNDARY, MODE_INT, 0);
!       TYPE_SIZE (type) = bitsize_int (FUNCTION_BOUNDARY);
!       TYPE_SIZE_UNIT (type) = size_int (FUNCTION_BOUNDARY / BITS_PER_UNIT);
        break;
  



More information about the Gcc mailing list