[Bug fortran/66227] [5/6/7 Regression] [OOP] EXTENDS_TYPE_OF n returns wrong result for polymorphic variable allocated to extended type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66227 janus at gcc dot gnu.org changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED --- Comment #11 from janus at gcc dot gnu.org --- (In reply to janus from comment #8) > I'll backport the fix to the release branches soon if no problems appear on > trunk. Both backports have been applied by now. Thus, the problem is fixed for the upcoming releases 5.5, 6.3 and 7.0. Closing. Thanks for the report!
[Bug fortran/66227] [5/6/7 Regression] [OOP] EXTENDS_TYPE_OF n returns wrong result for polymorphic variable allocated to extended type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66227 --- Comment #10 from janus at gcc dot gnu.org --- Author: janus Date: Wed Nov 23 16:46:31 2016 New Revision: 242770 URL: https://gcc.gnu.org/viewcvs?rev=242770=gcc=rev Log: 2016-11-23 Janus WeilBackport from trunk PR fortran/66227 * simplify.c (gfc_simplify_extends_type_of): Fix missed optimization. Prevent over-simplification. Fix a comment. Add a comment. 2016-11-23 Janus Weil Backport from trunk PR fortran/66227 * gfortran.dg/extends_type_of_3.f90: Fix and extend the test case. Modified: branches/gcc-5-branch/gcc/fortran/ChangeLog branches/gcc-5-branch/gcc/fortran/simplify.c branches/gcc-5-branch/gcc/testsuite/ChangeLog branches/gcc-5-branch/gcc/testsuite/gfortran.dg/extends_type_of_3.f90
[Bug fortran/66227] [5/6/7 Regression] [OOP] EXTENDS_TYPE_OF n returns wrong result for polymorphic variable allocated to extended type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66227 --- Comment #9 from janus at gcc dot gnu.org --- Author: janus Date: Wed Nov 23 16:26:38 2016 New Revision: 242768 URL: https://gcc.gnu.org/viewcvs?rev=242768=gcc=rev Log: 2016-11-23 Janus WeilBackport from trunk PR fortran/66227 * simplify.c (gfc_simplify_extends_type_of): Fix missed optimization. Prevent over-simplification. Fix a comment. Add a comment. 2016-11-23 Janus Weil Backport from trunk PR fortran/66227 * gfortran.dg/extends_type_of_3.f90: Fix and extend the test case. Modified: branches/gcc-6-branch/gcc/fortran/ChangeLog branches/gcc-6-branch/gcc/fortran/simplify.c branches/gcc-6-branch/gcc/testsuite/ChangeLog branches/gcc-6-branch/gcc/testsuite/gfortran.dg/extends_type_of_3.f90
[Bug fortran/66227] [5/6/7 Regression] [OOP] EXTENDS_TYPE_OF n returns wrong result for polymorphic variable allocated to extended type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66227 Jeffrey A. Law changed: What|Removed |Added Priority|P3 |P4 CC||law at redhat dot com
[Bug fortran/66227] [5/6/7 Regression] [OOP] EXTENDS_TYPE_OF n returns wrong result for polymorphic variable allocated to extended type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66227 janus at gcc dot gnu.org changed: What|Removed |Added Known to work||4.5.0 Target Milestone|--- |5.5 Known to fail||5.4.1, 6.2.0 --- Comment #8 from janus at gcc dot gnu.org --- Fixed on trunk with r242535. For more discussion of the fix see the thread starting at https://gcc.gnu.org/ml/fortran/2016-11/msg00150.html. I'll backport the fix to the release branches soon if no problems appear on trunk.
[Bug fortran/66227] [5/6/7 Regression] [OOP] EXTENDS_TYPE_OF n returns wrong result for polymorphic variable allocated to extended type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66227 --- Comment #7 from janus at gcc dot gnu.org --- Author: janus Date: Thu Nov 17 07:52:24 2016 New Revision: 242535 URL: https://gcc.gnu.org/viewcvs?rev=242535=gcc=rev Log: 2016-11-17 Janus WeilPR fortran/66227 * simplify.c (gfc_simplify_extends_type_of): Fix missed optimization. Prevent over-simplification. Fix a comment. Add a comment. 2016-11-17 Janus Weil PR fortran/66227 * gfortran.dg/extends_type_of_3.f90: Fix and extend the test case. Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/simplify.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gfortran.dg/extends_type_of_3.f90
[Bug fortran/66227] [5/6/7 Regression] [OOP] EXTENDS_TYPE_OF n returns wrong result for polymorphic variable allocated to extended type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66227 --- Comment #6 from janus at gcc dot gnu.org --- (In reply to janus from comment #5) > I'm currently not sure which one it is, but I'll investigate. I think it's both ;) extends_type_of_3.f90 is definitely wrong, because it contains the exact case reported in this PR. This fixes it: Index: gcc/testsuite/gfortran.dg/extends_type_of_3.f90 === --- gcc/testsuite/gfortran.dg/extends_type_of_3.f90 (Revision 242412) +++ gcc/testsuite/gfortran.dg/extends_type_of_3.f90 (Arbeitskopie) @@ -83,7 +83,6 @@ if (extends_type_of(b1,a1) .neqv. .true.) call should_not_exist() if (extends_type_of(b11,a1) .neqv. .true.) call should_not_exist() if (extends_type_of(b11,a11) .neqv. .true.) call should_not_exist() -if (extends_type_of(b1,a11) .neqv. .false.) call should_not_exist() if (extends_type_of(a1,b11) .neqv. .false.) call abort()
[Bug fortran/66227] [5/6/7 Regression] [OOP] EXTENDS_TYPE_OF n returns wrong result for polymorphic variable allocated to extended type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66227 --- Comment #5 from janus at gcc dot gnu.org --- (In reply to janus from comment #4) > The following patch fixes it: ... but unfortunately causes a failure of extends_type_of_3.f90 in the testsuite, which means either: * one of the tests in extends_type_of_3.f90 is wrong or * we're missing an optimization opportunity with my patch. I'm currently not sure which one it is, but I'll investigate.
[Bug fortran/66227] [5/6/7 Regression] [OOP] EXTENDS_TYPE_OF n returns wrong result for polymorphic variable allocated to extended type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66227 janus at gcc dot gnu.org changed: What|Removed |Added Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |janus at gcc dot gnu.org --- Comment #4 from janus at gcc dot gnu.org --- (In reply to janus from comment #3) > Confirmed. What's funny is that all eight cases are simplified to > compile-time constants. That clearly shouldn't be. Probably there's a bug in > gfc_simplify_extends_type_of. The regression is due to r168579. The following patch fixes it: Index: simplify.c === --- simplify.c (Revision 242412) +++ simplify.c (Arbeitskopie) @@ -2531,11 +2531,7 @@ mold->ts.u.derived->components->ts.u.derived) && !gfc_type_is_extension_of (mold->ts.u.derived->components->ts.u.derived, -a->ts.u.derived)) - || (a->ts.type == BT_CLASS && mold->ts.type == BT_DERIVED - && !gfc_type_is_extension_of - (mold->ts.u.derived, -a->ts.u.derived->components->ts.u.derived))) +a->ts.u.derived))) return gfc_get_logical_expr (gfc_default_logical_kind, >where, false); if (mold->ts.type == BT_DERIVED
[Bug fortran/66227] [5/6/7 Regression] [OOP] EXTENDS_TYPE_OF n returns wrong result for polymorphic variable allocated to extended type
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66227 janus at gcc dot gnu.org changed: What|Removed |Added CC||janus at gcc dot gnu.org Summary|[OOP] EXTENDS_TYPE_OF n |[5/6/7 Regression] [OOP] |returns wrong result for|EXTENDS_TYPE_OF n returns |polymorphic variable|wrong result for |allocated to extended type |polymorphic variable ||allocated to extended type --- Comment #3 from janus at gcc dot gnu.org --- Confirmed. What's funny is that all eight cases are simplified to compile-time constants. That clearly shouldn't be. Probably there's a bug in gfc_simplify_extends_type_of. I think this is a (very old) regression caused by PR 41850: gfortran 4.5 gets all the values right!