From: Jakub Jelinek Date: Thu, 18 Jun 2015 14:03:50 +0000 (+0200) Subject: re PR tree-optimization/66233 (internal compiler error: in expand_fix, at optabs... X-Git-Tag: releases/gcc-4.9.3~66 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f204c17f4ccb9b328f429c67134329810d8f264;p=thirdparty%2Fgcc.git re PR tree-optimization/66233 (internal compiler error: in expand_fix, at optabs.c:5358) PR tree-optimization/66233 * fold-const.c (fold_unary_loc): Don't handle vector types. Simplify. * tree-ssa-forwprop.c (combine_conversions): Likewise. * gcc.c-torture/execute/pr66233.c: New test. From-SVN: r224609 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8e158d701ac1..7684a354f6df 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-06-18 Jakub Jelinek + + PR tree-optimization/66233 + * fold-const.c (fold_unary_loc): Don't handle vector types. + Simplify. + * tree-ssa-forwprop.c (combine_conversions): Likewise. + 2015-06-16 Ramana Radhakrishnan PR target/66200 diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 82b68bf3a9d6..8e32c7222b56 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -8011,16 +8011,12 @@ fold_unary_loc (location_t loc, enum tree_code code, tree type, tree op0) (for integers). Avoid this if the final type is a pointer since then we sometimes need the middle conversion. Likewise if the final type has a precision not equal to the size of its mode. */ - if (((inter_int && inside_int) - || (inter_float && inside_float) - || (inter_vec && inside_vec)) + if (((inter_int && inside_int) || (inter_float && inside_float)) + && (final_int || final_float) && inter_prec >= inside_prec - && (inter_float || inter_vec - || inter_unsignedp == inside_unsignedp) + && (inter_float || inter_unsignedp == inside_unsignedp) && ! (final_prec != GET_MODE_PRECISION (TYPE_MODE (type)) - && TYPE_MODE (type) == TYPE_MODE (inter_type)) - && ! final_ptr - && (! final_vec || inter_prec == inside_prec)) + && TYPE_MODE (type) == TYPE_MODE (inter_type))) return fold_build1_loc (loc, code, type, TREE_OPERAND (op0, 0)); /* If we have a sign-extension of a zero-extended value, we can diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d97bdee5f39d..dd0298391f41 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-06-18 Jakub Jelinek + + PR tree-optimization/66233 + * gcc.c-torture/execute/pr66233.c: New test. + 2015-06-16 Ramana Radhakrishnan PR target/66200 diff --git a/gcc/testsuite/gcc.c-torture/execute/pr66233.c b/gcc/testsuite/gcc.c-torture/execute/pr66233.c new file mode 100644 index 000000000000..b0d63b685849 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/execute/pr66233.c @@ -0,0 +1,22 @@ +/* PR tree-optimization/66233 */ + +unsigned int v[8]; + +__attribute__((noinline, noclone)) void +foo (void) +{ + int i; + for (i = 0; i < 8; i++) + v[i] = (float) i; +} + +int +main () +{ + unsigned int i; + foo (); + for (i = 0; i < 8; i++) + if (v[i] != i) + __builtin_abort (); + return 0; +} diff --git a/gcc/tree-ssa-forwprop.c b/gcc/tree-ssa-forwprop.c index 99c3d0f3eb99..109b44f3f9ca 100644 --- a/gcc/tree-ssa-forwprop.c +++ b/gcc/tree-ssa-forwprop.c @@ -3036,16 +3036,12 @@ combine_conversions (gimple_stmt_iterator *gsi) (for integers). Avoid this if the final type is a pointer since then we sometimes need the middle conversion. Likewise if the final type has a precision not equal to the size of its mode. */ - if (((inter_int && inside_int) - || (inter_float && inside_float) - || (inter_vec && inside_vec)) + if (((inter_int && inside_int) || (inter_float && inside_float)) + && (final_int || final_float) && inter_prec >= inside_prec - && (inter_float || inter_vec - || inter_unsignedp == inside_unsignedp) + && (inter_float || inter_unsignedp == inside_unsignedp) && ! (final_prec != GET_MODE_PRECISION (TYPE_MODE (type)) - && TYPE_MODE (type) == TYPE_MODE (inter_type)) - && ! final_ptr - && (! final_vec || inter_prec == inside_prec)) + && TYPE_MODE (type) == TYPE_MODE (inter_type))) { gimple_assign_set_rhs1 (stmt, defop0); update_stmt (stmt);