From patchwork Wed Jul 13 08:28:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Build failure (Re: [PATCH] Make VRP optimize useless conversions) From: Richard Guenther X-Patchwork-Id: 104491 Message-Id: To: Ulrich Weigand Cc: Michael Matz , gcc-patches@gcc.gnu.org Date: Wed, 13 Jul 2011 10:28:14 +0200 (CEST) On Tue, 12 Jul 2011, Ulrich Weigand wrote: > Richard Guenther wrote: > > > 2011-07-11 Richard Guenther > > > > * tree-vrp.c (simplify_conversion_using_ranges): Manually > > translate the source value-range through the conversion chain. > > This causes a build failure in cachemgr.c on spu-elf. A slightly > modified simplified test case also fails on i386-linux: > > void * > test (unsigned long long x, unsigned long long y) > { > return (void *) (unsigned int) (x / y); > } > > compiled with -O2 results in: > > test.i: In function 'test': > test.i:3:1: error: invalid types in nop conversion > void * > long long unsigned int > D.1962_5 = (void *) D.1963_3; > > test.i:3:1: internal compiler error: verify_gimple failed > > Any thoughts? Fix in testing. Richard. 2011-07-13 Richard Guenther * tree-vrp.c (simplify_conversion_using_ranges): Make sure the final type is integral. * gcc.dg/torture/20110713-1.c: New testcase. Index: gcc/tree-vrp.c =================================================================== --- gcc/tree-vrp.c (revision 176224) +++ gcc/tree-vrp.c (working copy) @@ -7353,6 +7353,8 @@ simplify_conversion_using_ranges (gimple double_int innermin, innermax, middlemin, middlemax; finaltype = TREE_TYPE (gimple_assign_lhs (stmt)); + if (!INTEGRAL_TYPE_P (finaltype)) + return false; middleop = gimple_assign_rhs1 (stmt); def_stmt = SSA_NAME_DEF_STMT (middleop); if (!is_gimple_assign (def_stmt) Index: gcc/testsuite/gcc.dg/torture/20110713-1.c =================================================================== --- gcc/testsuite/gcc.dg/torture/20110713-1.c (revision 0) +++ gcc/testsuite/gcc.dg/torture/20110713-1.c (revision 0) @@ -0,0 +1,8 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target ilp32 } */ + +void * +test (unsigned long long x, unsigned long long y) +{ + return (void *) (unsigned int) (x / y); +}