From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10815 invoked by alias); 8 Sep 2013 16:46:34 -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 10778 invoked by uid 48); 8 Sep 2013 16:46:30 -0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/58331] [OOP] Bogus rank checking with explicit-/assumed-size arrays and CLASS Date: Sun, 08 Sep 2013 16:46: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.9.0 X-Bugzilla-Keywords: rejects-valid, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED 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: keywords 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-09/txt/msg00512.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58331 Tobias Burnus changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code --- Comment #2 from Tobias Burnus --- Actually, the patch is sufficient as one then runs into a tree checking error: class_array_20.f90:21:0: error: non-trivial conversion at assignment struct array1_unknown struct array2_integer(kind=4) if one looks at the dump, one sees that the actual argument still sends the array descriptor - but it shouldn't: parm.7.dim[0].lbound = 1; ... parm.7.data = (void *) &b[0]; class.6._data = parm.7; mysub (&class.6, &C.1946); Thus, the test case also doesn't work for rank == 1, if one checks the value. TODO * Sends in _data the array data, not the descriptor * Add a test case for the coindexed part of the patch below. * Augment the test case in comment 0 with a value check Updated patch: --- a/gcc/fortran/interface.c +++ b/gcc/fortran/interface.c @@ -2135 +2135,5 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, - || (actual->rank != 0 && !(is_elemental || formal->attr.dimension)) + || (actual->rank != 0 + && !(is_elemental + || (formal->ts.type != BT_CLASS && formal->attr.dimension) + || (formal->ts.type == BT_CLASS + && CLASS_DATA (formal)->attr.dimension))) @@ -2142 +2146,4 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, - || (actual->rank == 0 && formal->attr.dimension + || (actual->rank == 0 + && (formal->attr.dimension + || (formal->ts.type == BT_CLASS + && CLASS_DATA (formal)->attr.dimension)) @@ -2150 +2157,4 @@ compare_parameter (gfc_symbol *formal, gfc_expr *actual, - else if (actual->rank != 0 && (is_elemental || formal->attr.dimension)) + else if (actual->rank != 0 + && (is_elemental || formal->attr.dimension + || (formal->ts.type == BT_CLASS + && CLASS_DATA (formal)->attr.dimension)))