Message ID | 91d5c7a5-7bdb-5007-977d-3a214caca8b0@suse.cz |
---|---|
State | New |
Headers | show |
On Thu, Jul 7, 2016 at 4:01 PM, Martin Liška <mliska@suse.cz> wrote: > On 07/01/2016 12:15 PM, Richard Biener wrote: >> IMHO using fold-convert in this case is bogus and ideally the testcase >> should have been diagnosed. >> >> fold_convertible_p has a comment >> >> /* Returns true, if ARG is convertible to TYPE using a NOP_EXPR. * >> >> but clearly it isn't generating just a NOP_EXPR (or VIEW_CONVERT_EXPR >> or other single operation) here. >> >> So that is the thing to fix. The way we build / insert the init stmts >> can also be improved by properly >> gimplifying the rhs first but of course that likely runs into the >> SAVE_EXPR case you mentioned. >> >> Richard. > > Hello Richard. > > I've tried to mark COMPLEX_TYPE as not acceptable by fold_convertible_p, > which fixes the ICE and regression and bootstrap on x86_64-linux-gnu also looks > fine. > > Is it sufficient, or we would need more sophisticated approach to handle the PR? I think it's fine though the inliners initializer handling looks incredibly fragile to me ;) Richard. > Thanks, > Martin
On 07/07/2016 04:15 PM, Richard Biener wrote: > I think it's fine though the inliners initializer handling looks > incredibly fragile to me ;) > > Richard. OK, installed in trunk. May I install the patch to all active branches? Reg&bootstrap works for all of them.
On July 8, 2016 4:23:31 PM GMT+02:00, "Martin Liška" <mliska@suse.cz> wrote: >On 07/07/2016 04:15 PM, Richard Biener wrote: >> I think it's fine though the inliners initializer handling looks >> incredibly fragile to me ;) >> >> Richard. > >OK, installed in trunk. May I install the patch to all active branches? >Reg&bootstrap works for all of them. Sure. Richard.
From 9c11a34d262bccd2185f2cdcaa3b9db420366073 Mon Sep 17 00:00:00 2001 From: marxin <mliska@suse.cz> Date: Wed, 22 Jun 2016 18:07:55 +0200 Subject: [PATCH] Do not consider COMPLEX_TYPE as fold_convertible_p gcc/ChangeLog: 2016-06-22 Martin Liska <mliska@suse.cz> PR middle-end/71606 * fold-const.c (fold_convertible_p): As COMPLEX_TYPE folding produces SAVE_EXPRs, thus return false for the type. gcc/testsuite/ChangeLog: 2016-06-22 Martin Liska <mliska@suse.cz> * gcc.dg/torture/pr71606.c: New test. --- gcc/fold-const.c | 1 - gcc/testsuite/gcc.dg/torture/pr71606.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr71606.c diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 3b9500d..f5d634e 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/gcc.dg/torture/pr71606.c b/gcc/testsuite/gcc.dg/torture/pr71606.c new file mode 100644 index 0000000..b0cc26a --- /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.8.4