From: Bin Cheng Date: Wed, 7 Dec 2016 10:14:58 +0000 (+0000) Subject: re PR middle-end/78691 (ICE compiling Linux boot code) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ebf417348808be4608fd44ba3b2863b735b4324e;p=gcc.git re PR middle-end/78691 (ICE compiling Linux boot code) PR tree-optimization/78691 * match.pd ((convert1 (minmax ((convert2 (x) c)))) -> minmax (x c)): Require integral type for the outer expression. gcc/testsuite PR tree-optimization/78691 * gcc.target/i386/pr78691-i386.c: New test. * gcc.target/powerpc/pr78691-ppc.c: New test. From-SVN: r243335 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c1c148a536b..4f765705026 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-12-07 Bin Cheng + + PR tree-optimization/78691 + * match.pd ((convert1 (minmax ((convert2 (x) c)))) -> minmax (x c)): + Require integral type for the outer expression. + 2016-12-07 Naveen H.S * config/aarch64/aarch64.c diff --git a/gcc/match.pd b/gcc/match.pd index 1fe003ba158..feaa4a14478 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1378,7 +1378,8 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (for minmax (min max) (simplify (convert (minmax@0 (convert @1) INTEGER_CST@2)) - (if (types_match (@1, type) && int_fits_type_p (@2, type) + (if (INTEGRAL_TYPE_P (type) + && types_match (@1, type) && int_fits_type_p (@2, type) && TYPE_SIGN (TREE_TYPE (@0)) == TYPE_SIGN (type) && TYPE_PRECISION (TREE_TYPE (@0)) > TYPE_PRECISION (type)) (minmax @1 (convert @2))))) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2b9aad0d723..eeeae2ec16d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2016-12-07 Bin Cheng + + PR tree-optimization/78691 + * gcc.target/i386/pr78691-i386.c: New test. + * gcc.target/powerpc/pr78691-ppc.c: New test. + 2016-12-07 Rainer Orth * gcc.target/i386/pr70322-1.c: Add -mno-stackrealign to dg-options. diff --git a/gcc/testsuite/gcc.target/i386/pr78691-i386.c b/gcc/testsuite/gcc.target/i386/pr78691-i386.c new file mode 100644 index 00000000000..f4b88559bc3 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr78691-i386.c @@ -0,0 +1,14 @@ +/* PR tree-optimization/78691 */ +/* { dg-options "-Os -m16" } */ + +int fn1(char *p1, char *p2) { + int a; + for (;;) + switch (*p2) { + case 'c': + while (--a > 0) + *p1++ = ' '; + p1++; + a--; + } +} diff --git a/gcc/testsuite/gcc.target/powerpc/pr78691-ppc.c b/gcc/testsuite/gcc.target/powerpc/pr78691-ppc.c new file mode 100644 index 00000000000..73e3c876f9f --- /dev/null +++ b/gcc/testsuite/gcc.target/powerpc/pr78691-ppc.c @@ -0,0 +1,18 @@ +/* PR tree-optimization/78691 */ +/* { dg-options "-Os -m32" } */ + +int *b; +int fn1() { + char *c; + int a; + for (;;) + switch (*b) { + case 'c': + while (--a > 0) + *c++ = ' '; + c++; + if (a) + a = sizeof(void *); + } +} +