aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-switch-conversion.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2008-10-11 10:55:43 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2008-10-11 10:55:43 +0200
commit506a7bc8995f0ca9357eca2ff7cdeb857612e283 (patch)
tree7ee16b76a9eee4b027d70094c96fb31d27bea334 /gcc/tree-switch-conversion.c
parent8d22015287cfd2caf79f9374863ec4d9578227e0 (diff)
downloadgcc-506a7bc8995f0ca9357eca2ff7cdeb857612e283.zip
gcc-506a7bc8995f0ca9357eca2ff7cdeb857612e283.tar.gz
gcc-506a7bc8995f0ca9357eca2ff7cdeb857612e283.tar.bz2
re PR target/35760 (ICE with complex types and -static on PPC darwin)
PR target/35760 * config/rs6000/rs6000.c (rs6000_legitimize_address): Only create LO_SUM on Darwin if mode has just one unit. * gcc.c-torture/compile/pr35760.c: New test. From-SVN: r141055
Diffstat (limited to 'gcc/tree-switch-conversion.c')
-rw-r--r--gcc/tree-switch-conversion.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/gcc/tree-switch-conversion.c b/gcc/tree-switch-conversion.c
index e975745..798cf16 100644
--- a/gcc/tree-switch-conversion.c
+++ b/gcc/tree-switch-conversion.c
@@ -296,12 +296,29 @@ check_final_bb (void)
{
basic_block bb = gimple_phi_arg_edge (phi, i)->src;
- if ((bb == info.switch_bb
- || (single_pred_p (bb) && single_pred (bb) == info.switch_bb))
- && !is_gimple_ip_invariant (gimple_phi_arg_def (phi, i)))
+ if (bb == info.switch_bb
+ || (single_pred_p (bb) && single_pred (bb) == info.switch_bb))
{
- info.reason = " Non-invariant value from a case\n";
- return false; /* Non-invariant argument. */
+ tree reloc, val;
+
+ val = gimple_phi_arg_def (phi, i);
+ if (!is_gimple_ip_invariant (val))
+ {
+ info.reason = " Non-invariant value from a case\n";
+ return false; /* Non-invariant argument. */
+ }
+ reloc = initializer_constant_valid_p (val, TREE_TYPE (val));
+ if ((flag_pic && reloc != null_pointer_node)
+ || (!flag_pic && reloc == NULL_TREE))
+ {
+ if (reloc)
+ info.reason
+ = " Value from a case would need runtime relocations\n";
+ else
+ info.reason
+ = " Value from a case is not a valid initializer\n";
+ return false;
+ }
}
}
}