From fa6852317327d978d4069175952109505204f6ae Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Fri, 15 Jun 2018 11:08:30 +0000 Subject: [PATCH] re PR tree-optimization/86159 (g++ ICE at -O1 and above on valid code: incorrect type of vector CONSTRUCTOR elements) 2018-06-15 Richard Biener PR middle-end/86159 * tree-cfg.c (gimplify_build3): Do not strip sign conversions, leave useless conversion stripping to force_gimple_operand_gsi. (gimplify_build2): Likewise. (gimplify_build1): Likewise. * g++.dg/pr86159.C: New testcase. From-SVN: r261622 --- gcc/ChangeLog | 8 ++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/pr86159.C | 10 ++++++++++ gcc/tree-cfg.c | 6 ------ 4 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/g++.dg/pr86159.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8f95eb582f7..361c6e3a86e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2018-06-15 Richard Biener + + PR middle-end/86159 + * tree-cfg.c (gimplify_build3): Do not strip sign conversions, + leave useless conversion stripping to force_gimple_operand_gsi. + (gimplify_build2): Likewise. + (gimplify_build1): Likewise. + 2018-06-15 Richard Biener PR middle-end/86076 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 04278c6dcf0..262bb2d3585 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-06-15 Richard Biener + + PR middle-end/86159 + * g++.dg/pr86159.C: New testcase. + 2018-06-15 Richard Biener PR middle-end/86076 diff --git a/gcc/testsuite/g++.dg/pr86159.C b/gcc/testsuite/g++.dg/pr86159.C new file mode 100644 index 00000000000..83168f50c4a --- /dev/null +++ b/gcc/testsuite/g++.dg/pr86159.C @@ -0,0 +1,10 @@ +// { dg-do compile } +// { dg-options "-O -w -Wno-psabi" } + +typedef int vec __attribute__((vector_size(32))); +vec fn1() +{ + vec x, zero{}; + vec one = zero + 1; + return x < zero ? one : zero; +} diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 78d80b00045..85e845ff097 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -8976,8 +8976,6 @@ gimplify_build3 (gimple_stmt_iterator *gsi, enum tree_code code, location_t loc = gimple_location (gsi_stmt (*gsi)); ret = fold_build3_loc (loc, code, type, a, b, c); - STRIP_NOPS (ret); - return force_gimple_operand_gsi (gsi, ret, true, NULL, true, GSI_SAME_STMT); } @@ -8992,8 +8990,6 @@ gimplify_build2 (gimple_stmt_iterator *gsi, enum tree_code code, tree ret; ret = fold_build2_loc (gimple_location (gsi_stmt (*gsi)), code, type, a, b); - STRIP_NOPS (ret); - return force_gimple_operand_gsi (gsi, ret, true, NULL, true, GSI_SAME_STMT); } @@ -9008,8 +9004,6 @@ gimplify_build1 (gimple_stmt_iterator *gsi, enum tree_code code, tree type, tree ret; ret = fold_build1_loc (gimple_location (gsi_stmt (*gsi)), code, type, a); - STRIP_NOPS (ret); - return force_gimple_operand_gsi (gsi, ret, true, NULL, true, GSI_SAME_STMT); } -- 2.30.2