summaryrefslogtreecommitdiffstats
path: root/gcc/testsuite/gcc.dg/tree-ssa/pr22236.c
diff options
context:
space:
mode:
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2005-08-13 17:28:43 +0000
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2005-08-13 17:28:43 +0000
commit903dae48bdeed6191d043cd56f2345d332916ee4 (patch)
treee16e6f08588cfad8cd3b6712bf30a607ac5f488d /gcc/testsuite/gcc.dg/tree-ssa/pr22236.c
parent77beec480bdbed142d45a84de7bf61f265bdf3a2 (diff)
downloadppe42-gcc-903dae48bdeed6191d043cd56f2345d332916ee4.tar.gz
ppe42-gcc-903dae48bdeed6191d043cd56f2345d332916ee4.zip
PR tree-optimization/22236
* tree-cfg.c (print_pred_bbs, print_succ_bbs): Correctly print successors and predecessors. * tree-chrec.c (chrec_convert): Before converting, check that sequences don't wrap. * tree-data-ref.c (compute_estimated_nb_iterations): Moved ... (analyze_array): Extern. (find_data_references_in_loop): Remove call to compute_estimated_nb_iterations. * tree-data-ref.h (analyze_array): Declared. * tree-flow-inline.h (single_ssa_tree_operand, single_ssa_use_operand, single_ssa_def_operand, zero_ssa_operands): Fix documentation. * tree-flow.h (scev_probably_wraps_p): Declare with an extra parameter. * tree-scalar-evolution.c (instantiate_parameters_1): Factor entry condition. * tree-ssa-loop-ivcanon.c: Fix documentation. * tree-ssa-loop-ivopts.c (idx_find_step): Add a fixme note. * tree-ssa-loop-niter.c (compute_estimated_nb_iterations): ... here. (infer_loop_bounds_from_undefined): New. (estimate_numbers_of_iterations_loop): Use infer_loop_bounds_from_undefined. (used_in_pointer_arithmetic_p): New. (scev_probably_wraps_p): Pass an extra parameter. Call used_in_pointer_arithmetic_p. Check that AT_STMT is not null. (convert_step): Fix documentation. * tree-vrp.c (adjust_range_with_scev): Call instantiate_parameters. Use initial_condition_in_loop_num and evolution_part_in_loop_num instead of CHREC_LEFT and CHREC_RIGHT. Adjust the call to scev_probably_wraps_p. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103055 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/pr22236.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/pr22236.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr22236.c b/gcc/testsuite/gcc.dg/tree-ssa/pr22236.c
new file mode 100644
index 00000000000..1986c2f0cfe
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr22236.c
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+/* { dg-options "-O1 -fno-tree-vrp -fwrapv" } */
+
+/* PR tree-optimization/22236
+
+ Avoid conversion of (signed char) {(uchar)1, +, (uchar)1}_x when
+ it is not possible to prove that the scev does not wrap.
+
+ In this PR, a sequence 1, 2, ..., 255 has to be converted to
+ signed char, but this would wrap: 1, 2, ..., 127, -128, ... The
+ result should not be a linear scev {(schar)1, +, (schar)1}_x.
+ The conversion should be kept: (schar) {(uchar)1, +, (uchar)1}_x.
+ */
+
+void abort(void);
+
+static inline void
+foo (signed char a)
+{
+ int b = a - 0x7F;
+ if (b > 1)
+ abort();
+}
+
+int main()
+{
+ unsigned char b;
+ for(b = 0; b < 0xFF; b++)
+ foo (b);
+
+ return 0;
+}
+
OpenPOWER on IntegriCloud