From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17536 invoked by alias); 7 Oct 2013 19:31:22 -0000 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 Received: (qmail 17481 invoked by uid 48); 7 Oct 2013 19:31:18 -0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/58658] [OOP] Pointer assignment to allocatable unlimited polymorphic accepted Date: Mon, 07 Oct 2013 19:31: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-Version: 4.8.0 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-10/txt/msg00416.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58658 --- Comment #2 from Tobias Burnus --- (In reply to Tobias Burnus from comment #1) > Confirmed. Untested patch: Which of course doesn't work. What helps is the following patch (not regtested). I wonder why there is the unlimited check. - It looks completely bogus. --- a/gcc/fortran/expr.c +++ b/gcc/fortran/expr.c @@ -4693,7 +4693,6 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj, bool is_pointer; bool check_intentin; bool ptr_component; - bool unlimited; symbol_attribute attr; gfc_ref* ref; int i; @@ -4709,8 +4708,6 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj, sym = e->value.function.esym ? e->value.function.esym : e->symtree->n.sym; } - unlimited = e->ts.type == BT_CLASS && UNLIMITED_POLY (sym); - attr = gfc_expr_attr (e); if (!pointer && e->expr_type == EXPR_FUNCTION && attr.pointer) { @@ -4750,7 +4747,7 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj, /* Find out whether the expr is a pointer; this also means following component references to the last one. */ is_pointer = (attr.pointer || attr.proc_pointer); - if (pointer && !is_pointer && !unlimited) + if (pointer && !is_pointer) { if (context) gfc_error ("Non-POINTER in pointer association context (%s)"