Commit 76896993 by Thomas Koenig

iresolve.c (resolve_mask_arg): If a mask is an array expression, convert it to kind=1.

2007-09-13  Thomas Koenig  <tkoenig@gcc.gnu.org>

	* iresolve.c (resolve_mask_arg): If a mask is an array
	expression, convert it to kind=1.

From-SVN: r128477
parent 1d7d5ac4
2007-09-13 Thomas Koenig <tkoenig@gcc.gnu.org>
* iresolve.c (resolve_mask_arg): If a mask is an array
expression, convert it to kind=1.
2007-09-13 Tobias Burnus <burnus@net-b.de> 2007-09-13 Tobias Burnus <burnus@net-b.de>
PR fortran/33343 PR fortran/33343
......
...@@ -78,18 +78,32 @@ static void ...@@ -78,18 +78,32 @@ static void
resolve_mask_arg (gfc_expr *mask) resolve_mask_arg (gfc_expr *mask)
{ {
/* The mask can be any kind for an array. gfc_typespec ts;
For the scalar case, coerce it to kind=4 unconditionally
(because this is the only kind we have a library function
for). */
if (mask->rank == 0 && mask->ts.kind != 4) if (mask->rank == 0)
{ {
gfc_typespec ts; /* For the scalar case, coerce the mask to kind=4 unconditionally
(because this is the only kind we have a library function
for). */
ts.type = BT_LOGICAL; if (mask->ts.kind != 4)
ts.kind = 4; {
gfc_convert_type (mask, &ts, 2); ts.type = BT_LOGICAL;
ts.kind = 4;
gfc_convert_type (mask, &ts, 2);
}
}
else
{
/* In the library, we access the mask with a GFC_LOGICAL_1
argument. No need to waste memory if we are about to create
a temporary array. */
if (mask->expr_type == EXPR_OP)
{
ts.type = BT_LOGICAL;
ts.kind = 1;
gfc_convert_type (mask, &ts, 2);
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment