You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compile error, as a scalar variable can't be assigned to some array value ...
What are the steps to reproduce the bug?
Problem being:
elementalfunctionelem(x, y)
real:: x, y, elem, tmp
temp = y *2.0
elem = x + tmp
endfunction elemThisfunctioncan be called
* with `x` and `y` being scalars* with `x` and `y` being arrays of the same shape* with `x` or `y` being an array and the non-array being a scalar
Thus, e.g.:
```fortran
real:: x_scalar, b_scalar, res_scalar
real:: x_arr(10). y_arr(10), res_arr(10)
real:: x_arr_2(12). y_arr_2(12), res_arr_2(12)
res_scalar = elem(x_scalar, y_scalar)
res_arr = elem(x_arr, y_arr)
res_arr = elem(x_arr, y_scalar)
res_arr = elem(y_scalar, x_arr)
res_arr_2 = elem(x_arr_2, y_arr_2)
...
A quick solution is not possible, since:
adapting/adding the dimensions to the result var is not sufficient, since temporaries within the elemental function potentially need to be promoted as well
as shown above the same routine can be called in various ways influencing the inlining
The potential solution probably should
use a loop instead of vector notation to inline (to simplify the problem with promoting (some of) temporaries, ... in the end this could help us to solve it without need for (sophisticated) dataflow and dimension analysis)
reuse variables/temporaries (maybe introduce _scalar and _array versions of temporaries (and result)
Version
main
Platform (OS and architecture)
Mac / HPC2020
Relevant log output
No response
Accompanying data
No response
Organisation
No response
The text was updated successfully, but these errors were encountered:
What happened?
Compile error, as a scalar variable can't be assigned to some array value ...
What are the steps to reproduce the bug?
Problem being:
A quick solution is not possible, since:
The potential solution probably should
_scalar
and_array
versions of temporaries (and result)Version
main
Platform (OS and architecture)
Mac / HPC2020
Relevant log output
No response
Accompanying data
No response
Organisation
No response
The text was updated successfully, but these errors were encountered: