Commit 386a83c1 by Jakub Jelinek Committed by Jakub Jelinek

re PR bootstrap/89560 (ICE In function 'rtx_def* gen_vec_extract_lo_v64qi(rtx, rtx)')

	PR bootstrap/89560
	* fold-const.c (fold_checksum_tree): Don't use fixed size buffer,
	instead alloca it only when needed with the needed size.

	* g++.dg/other/pr89560.C: New test.

From-SVN: r269386
parent ea5212b7
2019-03-05 Jakub Jelinek <jakub@redhat.com> 2019-03-05 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/89560
* fold-const.c (fold_checksum_tree): Don't use fixed size buffer,
instead alloca it only when needed with the needed size.
PR tree-optimization/89570 PR tree-optimization/89570
* match.pd (vec_cond into cond_op simplification): Guard with * match.pd (vec_cond into cond_op simplification): Guard with
vectorized_internal_fn_supported_p test and #if GIMPLE. vectorized_internal_fn_supported_p test and #if GIMPLE.
......
...@@ -12112,7 +12112,7 @@ fold_checksum_tree (const_tree expr, struct md5_ctx *ctx, ...@@ -12112,7 +12112,7 @@ fold_checksum_tree (const_tree expr, struct md5_ctx *ctx,
{ {
const tree_node **slot; const tree_node **slot;
enum tree_code code; enum tree_code code;
union tree_node buf; union tree_node *buf;
int i, len; int i, len;
recursive_label: recursive_label:
...@@ -12127,11 +12127,13 @@ fold_checksum_tree (const_tree expr, struct md5_ctx *ctx, ...@@ -12127,11 +12127,13 @@ fold_checksum_tree (const_tree expr, struct md5_ctx *ctx,
&& HAS_DECL_ASSEMBLER_NAME_P (expr)) && HAS_DECL_ASSEMBLER_NAME_P (expr))
{ {
/* Allow DECL_ASSEMBLER_NAME and symtab_node to be modified. */ /* Allow DECL_ASSEMBLER_NAME and symtab_node to be modified. */
memcpy ((char *) &buf, expr, tree_size (expr)); size_t sz = tree_size (expr);
SET_DECL_ASSEMBLER_NAME ((tree)&buf, NULL); buf = XALLOCAVAR (union tree_node, sz);
buf.decl_with_vis.symtab_node = NULL; memcpy ((char *) buf, expr, sz);
buf.base.nowarning_flag = 0; SET_DECL_ASSEMBLER_NAME ((tree) buf, NULL);
expr = (tree) &buf; buf->decl_with_vis.symtab_node = NULL;
buf->base.nowarning_flag = 0;
expr = (tree) buf;
} }
else if (TREE_CODE_CLASS (code) == tcc_type else if (TREE_CODE_CLASS (code) == tcc_type
&& (TYPE_POINTER_TO (expr) && (TYPE_POINTER_TO (expr)
...@@ -12143,8 +12145,10 @@ fold_checksum_tree (const_tree expr, struct md5_ctx *ctx, ...@@ -12143,8 +12145,10 @@ fold_checksum_tree (const_tree expr, struct md5_ctx *ctx,
{ {
/* Allow these fields to be modified. */ /* Allow these fields to be modified. */
tree tmp; tree tmp;
memcpy ((char *) &buf, expr, tree_size (expr)); size_t sz = tree_size (expr);
expr = tmp = (tree) &buf; buf = XALLOCAVAR (union tree_node, sz);
memcpy ((char *) buf, expr, sz);
expr = tmp = (tree) buf;
TYPE_CONTAINS_PLACEHOLDER_INTERNAL (tmp) = 0; TYPE_CONTAINS_PLACEHOLDER_INTERNAL (tmp) = 0;
TYPE_POINTER_TO (tmp) = NULL; TYPE_POINTER_TO (tmp) = NULL;
TYPE_REFERENCE_TO (tmp) = NULL; TYPE_REFERENCE_TO (tmp) = NULL;
...@@ -12160,9 +12164,11 @@ fold_checksum_tree (const_tree expr, struct md5_ctx *ctx, ...@@ -12160,9 +12164,11 @@ fold_checksum_tree (const_tree expr, struct md5_ctx *ctx,
{ {
/* Allow TREE_NO_WARNING to be set. Perhaps we shouldn't allow that /* Allow TREE_NO_WARNING to be set. Perhaps we shouldn't allow that
and change builtins.c etc. instead - see PR89543. */ and change builtins.c etc. instead - see PR89543. */
memcpy ((char *) &buf, expr, tree_size (expr)); size_t sz = tree_size (expr);
buf.base.nowarning_flag = 0; buf = XALLOCAVAR (union tree_node, sz);
expr = (tree) &buf; memcpy ((char *) buf, expr, sz);
buf->base.nowarning_flag = 0;
expr = (tree) buf;
} }
md5_process_bytes (expr, tree_size (expr), ctx); md5_process_bytes (expr, tree_size (expr), ctx);
if (CODE_CONTAINS_STRUCT (code, TS_TYPED)) if (CODE_CONTAINS_STRUCT (code, TS_TYPED))
......
2019-03-05 Jakub Jelinek <jakub@redhat.com> 2019-03-05 Jakub Jelinek <jakub@redhat.com>
PR bootstrap/89560
* g++.dg/other/pr89560.C: New test.
PR tree-optimization/89570 PR tree-optimization/89570
* gcc.dg/pr89570.c: New test. * gcc.dg/pr89570.c: New test.
......
// PR bootstrap/89560
// { dg-do compile }
#define TEN(x) x##0, x##1, x##2, x##3, x##4, x##5, x##6, x##7, x##8, x##9,
#define HUNDRED(x) TEN(x##0) TEN(x##1) TEN(x##2) TEN(x##3) TEN(x##4) \
TEN(x##5) TEN(x##6) TEN(x##7) TEN(x##8) TEN(x##9)
int foo (int, ...);
int
bar ()
{
return (foo (HUNDRED (1) 0));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment