diff options
author | Richard Biener <rguenther@suse.de> | 2014-11-07 10:51:06 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2014-11-07 10:51:06 +0000 |
commit | ad6f996c03a59af22368102961cd6a5493943d11 (patch) | |
tree | 66e98f1ee6430462487660708a3c49427efcdcd0 | |
parent | a499aac5dfa5d9be4945c162167d13cfc07b2a81 (diff) | |
download | gcc-ad6f996c03a59af22368102961cd6a5493943d11.zip gcc-ad6f996c03a59af22368102961cd6a5493943d11.tar.gz gcc-ad6f996c03a59af22368102961cd6a5493943d11.tar.bz2 |
re PR middle-end/63770 (ICE on valid code at all optimization levels on x86_64-linux-gnu)
2014-11-07 Richard Biener <rguenther@suse.de>
PR middle-end/63770
* match.pd: Guard conflicting GENERIC pattern properly.
* gcc.dg/pr63770.c: New testcase.
From-SVN: r217214
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/match.pd | 17 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr63770.c | 16 |
4 files changed, 35 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8541a6c..88b7422 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2014-11-07 Richard Biener <rguenther@suse.de> + PR middle-end/63770 + * match.pd: Guard conflicting GENERIC pattern properly. + +2014-11-07 Richard Biener <rguenther@suse.de> + * match.pd: Add patterns for POINTER_PLUS_EXPR association and special patterns from tree-ssa-forwprop.c * fold-const.c (fold_binary_loc): Remove them here. diff --git a/gcc/match.pd b/gcc/match.pd index bbff19a..1c8b8db 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -129,14 +129,15 @@ along with GCC; see the file COPYING3. If not see (bitop (convert @0) (convert? @1)) (if (((TREE_CODE (@1) == INTEGER_CST && INTEGRAL_TYPE_P (TREE_TYPE (@0)) - && int_fits_type_p (@1, TREE_TYPE (@0)) - /* ??? This transform conflicts with fold-const.c doing - Convert (T)(x & c) into (T)x & (T)c, if c is an integer - constants (if x has signed type, the sign bit cannot be set - in c). This folds extension into the BIT_AND_EXPR. - Restrict it to GIMPLE to avoid endless recursions. */ - && (bitop != BIT_AND_EXPR || GIMPLE)) - || types_compatible_p (TREE_TYPE (@0), TREE_TYPE (@1))) + && int_fits_type_p (@1, TREE_TYPE (@0))) + || (GIMPLE && types_compatible_p (TREE_TYPE (@0), TREE_TYPE (@1))) + || (GENERIC && TREE_TYPE (@0) == TREE_TYPE (@1))) + /* ??? This transform conflicts with fold-const.c doing + Convert (T)(x & c) into (T)x & (T)c, if c is an integer + constants (if x has signed type, the sign bit cannot be set + in c). This folds extension into the BIT_AND_EXPR. + Restrict it to GIMPLE to avoid endless recursions. */ + && (bitop != BIT_AND_EXPR || GIMPLE) && (/* That's a good idea if the conversion widens the operand, thus after hoisting the conversion the operation will be narrower. */ TYPE_PRECISION (TREE_TYPE (@0)) < TYPE_PRECISION (type) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6117ac7..5e15814 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-11-07 Richard Biener <rguenther@suse.de> + + PR middle-end/63770 + * gcc.dg/pr63770.c: New testcase. + 2014-11-07 Terry Guo <terry.guo@arm.com> * gcc.target/arm/anddi_notdi-1.c: Match with UAL format. diff --git a/gcc/testsuite/gcc.dg/pr63770.c b/gcc/testsuite/gcc.dg/pr63770.c new file mode 100644 index 0000000..973df34 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr63770.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ + +char a; + +struct S +{ + int f0:9; +}; + +volatile struct S b; + +int +fn1 () +{ + return (1 & b.f0) < a; +} |