re PR middle-end/37380 (../../gcc/libcpp/charset.c:1103: error: 'cvt.77.width' is used uninitialized in this function)

2008-09-16  Richard Guenther  <rguenther@suse.de>

	PR middle-end/37380
	* tree-sra.c (sra_build_assignment): Do not call the gimplifier
	if not necessary.

	* gcc.c-torture/compile/pr37380.c: New testcase.

From-SVN: r140388
This commit is contained in:
Richard Guenther 2008-09-16 12:34:01 +00:00 committed by Richard Biener
parent 9cb57027a3
commit d573123d17
4 changed files with 70 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2008-09-16 Richard Guenther <rguenther@suse.de>
PR middle-end/37380
* tree-sra.c (sra_build_assignment): Do not call the gimplifier
if not necessary.
2008-09-16 Richard Guenther <rguenther@suse.de>
PR tree-optimization/37508

View File

@ -1,3 +1,8 @@
2008-09-16 Richard Guenther <rguenther@suse.de>
PR middle-end/37380
* gcc.c-torture/compile/pr37380.c: New testcase.
2008-09-16 Richard Guenther <rguenther@suse.de>
PR tree-optimization/37508

View File

@ -0,0 +1,51 @@
typedef struct basic_block_def *basic_block;
typedef struct gimple_seq_node_d *gimple_seq_node;
typedef struct gimple_seq_d *gimple_seq;
typedef struct
{
gimple_seq_node ptr;
gimple_seq seq;
basic_block bb;
} gimple_stmt_iterator;
typedef void *gimple;
extern void exit(int);
struct gimple_seq_node_d
{
gimple stmt;
struct gimple_seq_node_d *next;
};
struct gimple_seq_d
{
};
static __inline__ gimple_stmt_iterator
gsi_start (gimple_seq seq)
{
gimple_stmt_iterator i;
i.seq = seq;
return i;
}
static __inline__ unsigned char
gsi_end_p (gimple_stmt_iterator i)
{
return i.ptr == ((void *)0);
}
static __inline__ void
gsi_next (gimple_stmt_iterator *i)
{
i->ptr = i->ptr->next;
}
static __inline__ gimple
gsi_stmt (gimple_stmt_iterator i)
{
return i.ptr->stmt;
}
void
c_warn_unused_result (gimple_seq seq)
{
gimple_stmt_iterator i;
for (i = gsi_start (seq); !gsi_end_p (i); gsi_next (&i))
{
gimple g = gsi_stmt (i);
if (!g) exit(0);
}
}

View File

@ -2308,8 +2308,14 @@ sra_build_assignment (tree dst, tree src)
&& !useless_type_conversion_p (TREE_TYPE (dst), TREE_TYPE (src)))
src = fold_convert (TREE_TYPE (dst), src);
src = force_gimple_operand (src, &seq2, false, NULL_TREE);
gimple_seq_add_seq (&seq, seq2);
/* ??? Only call the gimplifier if we need to. Otherwise we may
end up substituting with DECL_VALUE_EXPR - see PR37380. */
if (!handled_component_p (src)
&& !SSA_VAR_P (src))
{
src = force_gimple_operand (src, &seq2, false, NULL_TREE);
gimple_seq_add_seq (&seq, seq2);
}
stmt = gimple_build_assign (dst, src);
gimple_seq_add_stmt (&seq, stmt);
return seq;