From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4644 invoked by alias); 16 Dec 2012 15:27:41 -0000 Received: (qmail 4591 invoked by uid 48); 16 Dec 2012 15:27:25 -0000 From: "pault at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/54990] [4.8 Regression] [OOP] ICE in tree_operand_check on SELECT TYPE Date: Sun, 16 Dec 2012 15:27:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pault at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P4 X-Bugzilla-Assigned-To: pault at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.0 X-Bugzilla-Changed-Fields: Status Last reconfirmed CC AssignedTo Ever Confirmed Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-12/txt/msg01629.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54990 Paul Thomas changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2012-12-16 CC| |pault at gcc dot gnu.org AssignedTo|unassigned at gcc dot |pault at gcc dot gnu.org |gnu.org | Ever Confirmed|0 |1 --- Comment #1 from Paul Thomas 2012-12-16 15:27:24 UTC --- trans-expr.c:203 tree gfc_get_vptr_from_expr (tree expr) { tree tmp = expr; while (tmp && !GFC_CLASS_TYPE_P (TREE_TYPE (tmp))) tmp = TREE_OPERAND (tmp, 0); tmp = gfc_class_vptr_get (tmp); return tmp; } is changed to tree gfc_get_vptr_from_expr (tree expr) { tree tmp = expr; while (tmp && !GFC_CLASS_TYPE_P (TREE_TYPE (tmp)) && !(TYPE_CANONICAL (TREE_TYPE (tmp)) && GFC_CLASS_TYPE_P (TYPE_CANONICAL (TREE_TYPE (tmp))))) tmp = TREE_OPERAND (tmp, 0); tmp = gfc_class_vptr_get (tmp); return tmp; } the bug is fixed. The array reference seems to spin a new TREE_TYPE for the class container that does not get marked as GFC_CLASS_TYPE_P. I have no idea why or what might have changed it. As soon as I get the unlimited polymorphic patch committed, I will submit this as a patch with the testcase: program test implicit none type :: ncBhStd integer :: i end type type :: tn class (ncBhStd), allocatable, dimension(:) :: cBh end type integer :: i type(tn), target :: a allocate (a%cBh(2), source = [(ncBhStd(i*99), i = 1,2)]) select type (q => a%cBh(1)) type is (ncBhStd) if (q%i .ne. 99) call abort end select end