This is the mail archive of the gcc@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]

Issues with TYPE_CACHED_VALUES


This is what is causing the failure of Ada to run at all.  I thought it was
something else, but hadn't done a "cvs update" on my tree for a few days, so
didn't pick it up yet.

There are a number of issues.

(1) Ada uses TYPE_VALUES for INTGER_CST, which is now TYPE_CACHED_VALUES.
That's easy to fix and actually eliminates the last such "stealth usage" from
ada-tree.h.

(2) The size of the cache allocated is INTEGER_SHARE_LIMIT for unsigned, but
that plus one for signed.  But when it's allocated in stor-layout.c, it just
uses INTEGER_SHARE_LIMIT.  However, sizetypes can be signed, and are for Ada.
This also is easy to fix, but I don't understand why the cache has to be
allocated there, though it may have to with the next item.

(3) When an INTEGER_CST is copied, TYPE_CACHED_VALUES needs to be cleared.  I
think this should be done in copy_node.  Instead, it's done in some callers,
but misses some.  The one that causes problems is in tree-inline.c, but I
strongly suspect there are others.

I have to get on a plane soon, so don't have time to do any more work on this.

Fixes for the first two problems are below:

*** ada/ada-tree.h  7 Jul 2004 04:30:29 -0000       1.3.4.16
--- ada/ada-tree.h  21 Aug 2004 09:22:52 -0000
*************** struct lang_type GTY(()) {union lang_tre
*** 166,170 ****
 
  /* For INTEGER_TYPE, stores the RM_Size of the type.  */
! #define TYPE_RM_SIZE_INT(NODE)        (INTEGER_TYPE_CHECK (NODE)->type.values)
 
  /* Likewise for ENUMERAL_TYPE.  */
--- 166,170 ----
 
  /* For INTEGER_TYPE, stores the RM_Size of the type.  */
! #define TYPE_RM_SIZE_INT(NODE)        (TYPE_LANG_SLOT_1 (INTEGER_TYPE_CHECK (NODE)))
 
  /* Likewise for ENUMERAL_TYPE.  */
*** stor-layout.c       20 Aug 2004 14:17:15 -0000      1.203
--- stor-layout.c       21 Aug 2004 09:12:05 -0000
*************** set_sizetype (tree type)
*** 1904,1910 ****
    /* Make copies of nodes since we'll be setting TYPE_IS_SIZETYPE.  */
    sizetype = copy_node (type);
!   TYPE_CACHED_VALUES (sizetype) = make_tree_vec (INTEGER_SHARE_LIMIT);
    TYPE_CACHED_VALUES_P (sizetype) = 1;
    TREE_TYPE (TYPE_CACHED_VALUES (sizetype)) = type;
    TYPE_IS_SIZETYPE (sizetype) = 1;
    bitsizetype = make_node (INTEGER_TYPE);
--- 1904,1915 ----
    /* Make copies of nodes since we'll be setting TYPE_IS_SIZETYPE.  */
    sizetype = copy_node (type);
!
!   /* Set up the value cache like build_int_cst.  */
!   TYPE_CACHED_VALUES (sizetype)
!     = make_tree_vec (INTEGER_SHARE_LIMIT
!                    + (TYPE_UNSIGNED (sizetype) ? 0 : 1));
    TYPE_CACHED_VALUES_P (sizetype) = 1;
    TREE_TYPE (TYPE_CACHED_VALUES (sizetype)) = type;
+
    TYPE_IS_SIZETYPE (sizetype) = 1;
    bitsizetype = make_node (INTEGER_TYPE);


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