From: Richard Guenther Date: Tue, 24 Feb 2009 11:05:15 +0000 (+0000) Subject: re PR tree-optimization/39233 (ivopts + vrp miscompilation) X-Git-Tag: releases/gcc-4.4.0~448 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=71adbef3ea0454c98d098d7adfc071aa29fa0a88;p=thirdparty%2Fgcc.git re PR tree-optimization/39233 (ivopts + vrp miscompilation) 2009-02-24 Richard Guenther Zdenek Dvorak PR tree-optimization/39233 * tree-ssa-loop-ivopts.c (add_candidate_1): Do not except pointers from converting them to a generic type. * gcc.c-torture/execute/pr39233.c: New testcase. Co-Authored-By: Zdenek Dvorak From-SVN: r144405 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 19104625f6cd..c89a3f473377 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2009-02-24 Richard Guenther + Zdenek Dvorak + + PR tree-optimization/39233 + * tree-ssa-loop-ivopts.c (add_candidate_1): Do not except pointers + from converting them to a generic type. + 2009-02-23 Sebastian Pop PR tree-optimization/39260 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4256418d318d..4af6e1843628 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2009-02-24 Richard Guenther + Zdenek Dvorak + + PR tree-optimization/39233 + * gcc.c-torture/execute/pr39233.c: New testcase. + 2009-02-23 Sebastian Pop PR tree-optimization/39260 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr39233.c b/gcc/testsuite/gcc.c-torture/execute/pr39233.c new file mode 100644 index 000000000000..29f722395cfa --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr39233.c @@ -0,0 +1,18 @@ +extern void abort (void); + +__attribute__((noinline)) void +foo (void *p) +{ + long l = (long) p; + if (l < 0 || l > 6) + abort (); +} + +int +main () +{ + short i; + for (i = 6; i >= 0; i--) + foo ((void *) (long) i); + return 0; +} diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c index ca1ab98b85af..b1813d373dc4 100644 --- a/gcc/tree-ssa-loop-ivopts.c +++ b/gcc/tree-ssa-loop-ivopts.c @@ -2071,9 +2071,7 @@ add_candidate_1 (struct ivopts_data *data, { orig_type = TREE_TYPE (base); type = generic_type_for (orig_type); - /* Don't convert the base to the generic type for pointers as the generic - type is an integer type with the same size as the pointer type. */ - if (type != orig_type && !POINTER_TYPE_P (orig_type)) + if (type != orig_type) { base = fold_convert (type, base); step = fold_convert (type, step);