From 2660286dcab0a72865faa3406c1e81572a1e42c8 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Fri, 8 Jul 2016 09:52:03 +0200 Subject: [PATCH] Do not consider COMPLEX_TYPE as fold_convertible_p PR middle-end/71606 * fold-const.c (fold_convertible_p): As COMPLEX_TYPE folding produces SAVE_EXPRs, thus return false for the type. * gcc.dg/torture/pr71606.c: New test. From-SVN: r238157 --- gcc/ChangeLog | 6 ++++++ gcc/fold-const.c | 1 - gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.dg/torture/pr71606.c | 11 +++++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr71606.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c3d63275775..afd022ed7f3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-07-08 Martin Liska + + PR middle-end/71606 + * fold-const.c (fold_convertible_p): As COMPLEX_TYPE + folding produces SAVE_EXPRs, thus return false for the type. + 2016-07-07 Martin Liska * file-find.c (remove_prefix): New function. diff --git a/gcc/fold-const.c b/gcc/fold-const.c index f97b8bf6978..ac051ff96ef 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -2192,7 +2192,6 @@ fold_convertible_p (const_tree type, const_tree arg) case REAL_TYPE: case FIXED_POINT_TYPE: - case COMPLEX_TYPE: case VECTOR_TYPE: case VOID_TYPE: return TREE_CODE (type) == TREE_CODE (orig); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 22a4a588803..8a4dc1d5b3d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2016-07-08 Martin Liska + + * gcc.dg/torture/pr71606.c: New test. + 2016-07-07 Jerry DeLisle PR fortran/71764 diff --git a/gcc/testsuite/gcc.dg/torture/pr71606.c b/gcc/testsuite/gcc.dg/torture/pr71606.c new file mode 100644 index 00000000000..b0cc26ac771 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr71606.c @@ -0,0 +1,11 @@ +_Complex a; +void fn1 (); + +int main () { + fn1 (a); + return 0; +} + +void fn1 (__complex__ long double p1) { + __imag__ p1 = 6.0L; +} -- 2.30.2