diff mbox

Move DECL_VINDEX and DECL_SAVED_TREE into function_decl

Message ID 87egxtr19t.fsf@kepler.schwinge.homeip.net
State New
Headers show

Commit Message

Thomas Schwinge July 10, 2014, 9:50 a.m. UTC
Hi!

On Mon, 23 Jun 2014 22:25:41 +0200, Jan Hubicka <hubicka@ucw.cz> wrote:
> this patch makes DECL_VINDEX and DECL_SAVED_TREE to be FUNCTION_DECL only.

> Bootstrapped/regtested x86_64-linux, OK?

... without --enable-checking=fold.  ;-P

> 	* class.c (check_methods, create_vtable_ptr, determine_key_method,
> 	add_vcall_offset_vtbl_entries_1): Guard VINDEX checks by FUNCTION_DECL check.
> 	* cp-tree.h (lang_decl_ns): Add ns_using and ns_users.
> 	(DECL_NAMESPACE_USING, DECL_NAMESPACE_USERS): Use lang_decl_ns.
> 	(DECL_NAMESPACE_ASSOCIATIONS): Use DECL_INITIAL.
> 	(DECL_TEMPLATE_INSTANTIATIONS): Use DECL_SIZE_UNIT.
> 	* tree.c (find_decls_types_r): Do not check DECL_VINDEX for TYPE_DECL.
> 	* tree.h (DECL_VINDEX, DECL_SAVED_TREE): Restrict to DECL_FUNCTION.
> 	* tree-core.h (tree_decl_non_common): Move saved_tree and vindex...
> 	(tree_function_decl): ... here.
> 	* tree-streamer-out.c (write_ts_decl_non_common_tree_pointers): Move
> 	streaming of vindex to ...
> 	(write_ts_function_decl_tree_pointers): ... here.
> 
> 	* tree-streamer-in.c (lto_input_ts_decl_non_common_tree_pointers):
> 	Do not stream DECL_VINDEX.
> 	(lto_input_ts_function_decl_tree_pointers): Stream it here.
> 
> 	* lto.c (mentions_vars_p_decl_non_common): Move DECL_VINDEX check to ..
> 	(mentions_vars_p_function): ... here.
> 	(compare_tree_sccs_1): Update VINDEX checks.
> 	(lto_fixup_prevailing_decls): Likewise.

I'm seeing ICEs: »tree check: expected function_decl, have type_decl in
fold_checksum_tree, at fold-const.c:14861«.  Is the following the correct
fix, or should this be done differently?



Grüße,
 Thomas

Comments

Richard Biener July 10, 2014, 11:36 a.m. UTC | #1
On Thu, Jul 10, 2014 at 11:50 AM, Thomas Schwinge
<thomas@codesourcery.com> wrote:
> Hi!
>
> On Mon, 23 Jun 2014 22:25:41 +0200, Jan Hubicka <hubicka@ucw.cz> wrote:
>> this patch makes DECL_VINDEX and DECL_SAVED_TREE to be FUNCTION_DECL only.
>
>> Bootstrapped/regtested x86_64-linux, OK?
>
> ... without --enable-checking=fold.  ;-P
>
>>       * class.c (check_methods, create_vtable_ptr, determine_key_method,
>>       add_vcall_offset_vtbl_entries_1): Guard VINDEX checks by FUNCTION_DECL check.
>>       * cp-tree.h (lang_decl_ns): Add ns_using and ns_users.
>>       (DECL_NAMESPACE_USING, DECL_NAMESPACE_USERS): Use lang_decl_ns.
>>       (DECL_NAMESPACE_ASSOCIATIONS): Use DECL_INITIAL.
>>       (DECL_TEMPLATE_INSTANTIATIONS): Use DECL_SIZE_UNIT.
>>       * tree.c (find_decls_types_r): Do not check DECL_VINDEX for TYPE_DECL.
>>       * tree.h (DECL_VINDEX, DECL_SAVED_TREE): Restrict to DECL_FUNCTION.
>>       * tree-core.h (tree_decl_non_common): Move saved_tree and vindex...
>>       (tree_function_decl): ... here.
>>       * tree-streamer-out.c (write_ts_decl_non_common_tree_pointers): Move
>>       streaming of vindex to ...
>>       (write_ts_function_decl_tree_pointers): ... here.
>>
>>       * tree-streamer-in.c (lto_input_ts_decl_non_common_tree_pointers):
>>       Do not stream DECL_VINDEX.
>>       (lto_input_ts_function_decl_tree_pointers): Stream it here.
>>
>>       * lto.c (mentions_vars_p_decl_non_common): Move DECL_VINDEX check to ..
>>       (mentions_vars_p_function): ... here.
>>       (compare_tree_sccs_1): Update VINDEX checks.
>>       (lto_fixup_prevailing_decls): Likewise.
>
> I'm seeing ICEs: »tree check: expected function_decl, have type_decl in
> fold_checksum_tree, at fold-const.c:14861«.  Is the following the correct
> fix, or should this be done differently?
>
> --- gcc/fold-const.c
> +++ gcc/fold-const.c
> @@ -14858,7 +14858,8 @@ fold_checksum_tree (const_tree expr, struct md5_ctx *ctx,
>
>        if (CODE_CONTAINS_STRUCT (TREE_CODE (expr), TS_DECL_NON_COMMON))
>         {
> -         fold_checksum_tree (DECL_VINDEX (expr), ctx, ht);
> +         if (TREE_CODE (expr) == FUNCTION_DECL)
> +           fold_checksum_tree (DECL_VINDEX (expr), ctx, ht);
>           fold_checksum_tree (DECL_RESULT_FLD (expr), ctx, ht);
>           fold_checksum_tree (DECL_ARGUMENT_FLD (expr), ctx, ht);
>         }
>

Looks good to me.

Richard.

> Grüße,
>  Thomas
Jan Hubicka July 10, 2014, 11:57 a.m. UTC | #2
> I'm seeing ICEs: »tree check: expected function_decl, have type_decl in
> fold_checksum_tree, at fold-const.c:14861«.  Is the following the correct
> fix, or should this be done differently?

No, it seems fine to me.  I added it to my local patch, thanks!
Honza
> 
> --- gcc/fold-const.c
> +++ gcc/fold-const.c
> @@ -14858,7 +14858,8 @@ fold_checksum_tree (const_tree expr, struct md5_ctx *ctx,
>  
>        if (CODE_CONTAINS_STRUCT (TREE_CODE (expr), TS_DECL_NON_COMMON))
>  	{
> -	  fold_checksum_tree (DECL_VINDEX (expr), ctx, ht);
> +	  if (TREE_CODE (expr) == FUNCTION_DECL)
> +	    fold_checksum_tree (DECL_VINDEX (expr), ctx, ht);
>  	  fold_checksum_tree (DECL_RESULT_FLD (expr), ctx, ht);
>  	  fold_checksum_tree (DECL_ARGUMENT_FLD (expr), ctx, ht);
>  	}
> 
> 
> Grüße,
>  Thomas
diff mbox

Patch

--- gcc/fold-const.c
+++ gcc/fold-const.c
@@ -14858,7 +14858,8 @@  fold_checksum_tree (const_tree expr, struct md5_ctx *ctx,
 
       if (CODE_CONTAINS_STRUCT (TREE_CODE (expr), TS_DECL_NON_COMMON))
 	{
-	  fold_checksum_tree (DECL_VINDEX (expr), ctx, ht);
+	  if (TREE_CODE (expr) == FUNCTION_DECL)
+	    fold_checksum_tree (DECL_VINDEX (expr), ctx, ht);
 	  fold_checksum_tree (DECL_RESULT_FLD (expr), ctx, ht);
 	  fold_checksum_tree (DECL_ARGUMENT_FLD (expr), ctx, ht);
 	}