diff options
author | Richard Guenther <rguenther@suse.de> | 2008-09-16 12:34:01 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2008-09-16 12:34:01 +0000 |
commit | d573123d17fb48ec675aa25f4e8a9754d876228c (patch) | |
tree | 1dc33f94664f6b2d5b93ba40a31ffe948fc220aa /gcc | |
parent | 9cb57027a39541712b049df895beda264d73d5ca (diff) | |
download | gcc-d573123d17fb48ec675aa25f4e8a9754d876228c.tar.gz |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr37380.c | 51 | ||||
-rw-r--r-- | gcc/tree-sra.c | 10 |
4 files changed, 70 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b413f20c29b..ff6e2452164 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 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 * tree-vrp.c (simplify_truth_ops_using_ranges): Also allow -1. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 32c44354c50..0ad3a64a2dd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 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 * gcc.dg/tree-ssa/pr37508.c: New testcase. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37380.c b/gcc/testsuite/gcc.c-torture/compile/pr37380.c new file mode 100644 index 00000000000..d757e0245a0 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr37380.c @@ -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); + } +} diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 01f90844bd0..3689b69f757 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -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; |