Fix copy_node of TEMPLATE_INFO.

build_clone uses copy_node to duplicate the TEMPLATE_INFO for a clone, but
this clears TREE_CHAIN, which was TI_ARGS in a TEMPLATE_INFO.

	* cp-tree.h (struct tree_template_info): Use tree_base instead of
	tree_common.  Add tmpl and args fields.
	(TI_TEMPLATE, TI_ARGS): Adjust.

From-SVN: r273943
This commit is contained in:
Jason Merrill 2019-07-31 14:49:28 -04:00 committed by Jason Merrill
parent b6de302895
commit fc79fc4966
3 changed files with 14 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2019-07-31 Jason Merrill <jason@redhat.com>
Fix copy_node of TEMPLATE_INFO.
* cp-tree.h (struct tree_template_info): Use tree_base instead of
tree_common. Add tmpl and args fields.
(TI_TEMPLATE, TI_ARGS): Adjust.
2019-07-30 Martin Liska <mliska@suse.cz>
PR tree-optimization/91270

View File

@ -373,7 +373,6 @@ cp_common_init_ts (void)
MARK_TS_COMMON (TEMPLATE_TYPE_PARM);
MARK_TS_COMMON (TEMPLATE_PARM_INDEX);
MARK_TS_COMMON (OVERLOAD);
MARK_TS_COMMON (TEMPLATE_INFO);
MARK_TS_COMMON (TYPENAME_TYPE);
MARK_TS_COMMON (TYPEOF_TYPE);
MARK_TS_COMMON (UNDERLYING_TYPE);

View File

@ -1437,7 +1437,9 @@ typedef struct qualified_typedef_usage_s qualified_typedef_usage_t;
(TREE_LANG_FLAG_1 (TEMPLATE_INFO_CHECK (NODE)))
struct GTY(()) tree_template_info {
struct tree_common common;
struct tree_base base;
tree tmpl;
tree args;
vec<qualified_typedef_usage_t, va_gc> *typedefs_needing_access_checking;
};
@ -3420,8 +3422,10 @@ struct GTY(()) lang_decl {
? (TYPE_LANG_SLOT_1 (NODE) = (VAL)) \
: (DECL_TEMPLATE_INFO (TYPE_NAME (NODE)) = (VAL)))
#define TI_TEMPLATE(NODE) TREE_TYPE (TEMPLATE_INFO_CHECK (NODE))
#define TI_ARGS(NODE) TREE_CHAIN (TEMPLATE_INFO_CHECK (NODE))
#define TI_TEMPLATE(NODE) \
((struct tree_template_info*)TEMPLATE_INFO_CHECK (NODE))->tmpl
#define TI_ARGS(NODE) \
((struct tree_template_info*)TEMPLATE_INFO_CHECK (NODE))->args
#define TI_PENDING_TEMPLATE_FLAG(NODE) \
TREE_LANG_FLAG_1 (TEMPLATE_INFO_CHECK (NODE))
/* For a given TREE_VEC containing a template argument list,