aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/tree-ssa/vrp85.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2012-10-05 11:37:25 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2012-10-05 11:37:25 +0200
commit440d347233baeb164433435f63fda2093e98cb6a (patch)
tree53aad70f269552ef0dbc7184a9b6589dc2ac08d4 /gcc/testsuite/gcc.dg/tree-ssa/vrp85.c
parent5e3e4fe8749caf4f90f41910458d094bc4519f69 (diff)
downloadgcc-440d347233baeb164433435f63fda2093e98cb6a.zip
gcc-440d347233baeb164433435f63fda2093e98cb6a.tar.gz
gcc-440d347233baeb164433435f63fda2093e98cb6a.tar.bz2
re PR tree-optimization/54810 (VRP doesn't handle comparison of narrowing cast like comparison of BIT_AND_EXPR)
PR tree-optimization/54810 * tree-vrp.c (register_edge_assert_for_2): Handle NAME = (unsigned) NAME2; if (NAME cmp CST) for narrowing casts to unsigned integral type like NAME = NAME2 & CST2; if (NAME cmp CST) where CST2 is the max value of the unsigned integral type. * gcc.dg/tree-ssa/vrp85.c: New test. From-SVN: r192115
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/vrp85.c')
-rw-r--r--gcc/testsuite/gcc.dg/tree-ssa/vrp85.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/vrp85.c b/gcc/testsuite/gcc.dg/tree-ssa/vrp85.c
new file mode 100644
index 0000000..ad2b38d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/vrp85.c
@@ -0,0 +1,40 @@
+/* PR tree-optimization/54810 */
+/* { dg-do link } */
+/* { dg-options "-O2 -fdump-tree-vrp1" } */
+
+extern void link_error (void);
+
+#define T(n, ntype, wtype) \
+void \
+f##n (wtype s) \
+{ \
+ if ((ntype) s == 0) \
+ return; \
+ if (s == 0) \
+ link_error (); \
+}
+
+T(1, unsigned char, unsigned char)
+T(2, unsigned char, unsigned short)
+T(3, unsigned char, unsigned int)
+T(4, unsigned char, unsigned long int)
+T(5, unsigned char, unsigned long long int)
+T(6, unsigned short int, unsigned short int)
+T(7, unsigned short int, unsigned int)
+T(8, unsigned short int, unsigned long int)
+T(9, unsigned short int, unsigned long long int)
+T(10, unsigned int, unsigned int)
+T(11, unsigned int, unsigned long int)
+T(12, unsigned int, unsigned long long int)
+T(13, unsigned long int, unsigned long int)
+T(14, unsigned long int, unsigned long long int)
+T(15, unsigned long long int, unsigned long long int)
+
+int
+main ()
+{
+ return 0;
+}
+
+/* { dg-final { scan-tree-dump-not "link_error" "vrp1"} } */
+/* { dg-final { cleanup-tree-dump "vrp1" } } */