https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107000

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael at gcc dot gnu.org

--- Comment #13 from Mikael Morin <mikael at gcc dot gnu.org> ---
Here is my understanding of the problem.

There is a check on operand types in eval_intrinsic guarding numerical
evaluation:

1573    case INTRINSIC_PLUS:
1574    case INTRINSIC_MINUS:
1575    case INTRINSIC_TIMES:
1576    case INTRINSIC_DIVIDE:
1577    case INTRINSIC_POWER:
1578      if (!gfc_numeric_ts (&op1->ts) || !gfc_numeric_ts (&op2->ts))
1579    goto runtime;

If we pass this check, we proceed to reduce_binary, where if one (or both) of
the operands is an array, we do numerical evaluation for every element of the
array.

With the guarding check above, it is safe, with the assumption that elements of
an array have the same type as the array itself.  If that condition is not
true, well, it doesn't work obviously.

I don't see right now where an additional check would fit well, but the fix
doesn't belong to walk_array_constructor in any case from my point of view.

Reply via email to