[Bug fortran/58331] [OOP] Bogus rank checking with explicit-/assumed-size arrays and CLASS
burnus at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Sep 8 16:46:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58331
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> ---
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)))
More information about the Gcc-bugs
mailing list