diff options
author | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-31 16:40:09 +0000 |
---|---|---|
committer | pinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-05-31 16:40:09 +0000 |
commit | b732b5f36c4aca6a8ed7437bdb367f7bfffbba31 (patch) | |
tree | 841cd73dd378c353190d93fd81e931ed2544fbee | |
parent | 23dc933913907878bd5fee64389173b8f45771cd (diff) | |
download | gcc-b732b5f36c4aca6a8ed7437bdb367f7bfffbba31.tar.gz |
2005-05-31 Andrew pinski <pinskia@physics.uc.edu>
PR middle-end/20931
* g++.dg/opt/pr20931.C: New test.
2005-05-31 Andrew Pinski <pinskia@physics.uc.edu>
PR middle-end/20931
PR middle-end/20946
* fold-const.c (fold_checksum_tree): Copy types also if
TYPE_CONTAINS_PLACEHOLDER_INTERNAL is set.
Don't call fold_checksum_tree for TREE_LIST's TREE_CHAIN
first.
Tail recurse TREE_LIST's TREE_CHAIN.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@100397 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/fold-const.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/opt/pr20931.C | 13 |
4 files changed, 37 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 25cd8c645b6..f486794d600 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,15 @@ 2005-05-31 Andrew Pinski <pinskia@physics.uc.edu> + PR middle-end/20931 + PR middle-end/20946 + * fold-const.c (fold_checksum_tree): Copy types also if + TYPE_CONTAINS_PLACEHOLDER_INTERNAL is set. + Don't call fold_checksum_tree for TREE_LIST's TREE_CHAIN + first. + Tail recurse TREE_LIST's TREE_CHAIN. + +2005-05-31 Andrew Pinski <pinskia@physics.uc.edu> + PR tree-opt/21732 * tree-ssa-copy.c (dump_copy_of): Create a bitmap and don't visit a SSA_NAME twice and cause the loop to become finite. Remove the test diff --git a/gcc/fold-const.c b/gcc/fold-const.c index c780659b556..97caf1515a2 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -10419,6 +10419,8 @@ fold_checksum_tree (tree expr, struct md5_ctx *ctx, htab_t ht) enum tree_code code; char buf[sizeof (struct tree_decl)]; int i, len; + +recursive_label: gcc_assert ((sizeof (struct tree_exp) + 5 * sizeof (tree) <= sizeof (struct tree_decl)) @@ -10440,11 +10442,13 @@ fold_checksum_tree (tree expr, struct md5_ctx *ctx, htab_t ht) } else if (TREE_CODE_CLASS (code) == tcc_type && (TYPE_POINTER_TO (expr) || TYPE_REFERENCE_TO (expr) - || TYPE_CACHED_VALUES_P (expr))) + || TYPE_CACHED_VALUES_P (expr) + || TYPE_CONTAINS_PLACEHOLDER_INTERNAL (expr))) { /* Allow these fields to be modified. */ memcpy (buf, expr, tree_size (expr)); expr = (tree) buf; + TYPE_CONTAINS_PLACEHOLDER_INTERNAL (expr) = 0; TYPE_POINTER_TO (expr) = NULL; TYPE_REFERENCE_TO (expr) = NULL; if (TYPE_CACHED_VALUES_P (expr)) @@ -10456,7 +10460,8 @@ fold_checksum_tree (tree expr, struct md5_ctx *ctx, htab_t ht) md5_process_bytes (expr, tree_size (expr), ctx); fold_checksum_tree (TREE_TYPE (expr), ctx, ht); if (TREE_CODE_CLASS (code) != tcc_type - && TREE_CODE_CLASS (code) != tcc_declaration) + && TREE_CODE_CLASS (code) != tcc_declaration + && code != TREE_LIST) fold_checksum_tree (TREE_CHAIN (expr), ctx, ht); switch (TREE_CODE_CLASS (code)) { @@ -10484,6 +10489,8 @@ fold_checksum_tree (tree expr, struct md5_ctx *ctx, htab_t ht) case TREE_LIST: fold_checksum_tree (TREE_PURPOSE (expr), ctx, ht); fold_checksum_tree (TREE_VALUE (expr), ctx, ht); + expr = TREE_CHAIN (expr); + goto recursive_label; break; case TREE_VEC: for (i = 0; i < TREE_VEC_LENGTH (expr); ++i) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c5f860a7490..2b499e94dd7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-05-31 Andrew pinski <pinskia@physics.uc.edu> + + PR middle-end/20931 + * g++.dg/opt/pr20931.C: New test. + 2005-05-31 Andreas Jaeger <aj@suse.de> PR testsuite/20772 diff --git a/gcc/testsuite/g++.dg/opt/pr20931.C b/gcc/testsuite/g++.dg/opt/pr20931.C new file mode 100644 index 00000000000..01518c06d24 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr20931.C @@ -0,0 +1,13 @@ +// PR middle-end +// This testcase ICEd because fold checking saw a type change which +// is allowed as TYPE_CONTAINS_PLACEHOLDER_INTERNAL could change. +// { dg-do compile } +// { dg-options "-O2" } + +int +__finite (double __x) throw () +{ + return (__extension__ + (((((union { double __d; int __i[2]; }) {__d: __x}).__i[1] + | 0x800fffffu) + 1) >> 31)); +} |