- Index
- » Programming
- » Modelica Language
- » COMPILER BUG
COMPILER BUG
COMPILER BUG
Hi. I was trying out the different Modelica array constructs and found this shown then i tried to simulate.
Code:
"[<interactive>:8:3-8:31:writable] Error: Got type mismatch error, but matching types Real[2, 2].
This is a ***COMPILER BUG***, please report it to https://trac.openmodelica.org/OpenModelica.
Error: Error occurred while flattening model ArrayFunctions5
"
Here is the model which led to the error.
Code:
model ArrayFunctions5 "Matrix and Vector Algebra Functions"
Real[2,2] A = [1,2;3,4];
Real[2,2] AT;
Real[2] v1 = {2,1},v2 = {3,2};
Real[2,2] oProd;
equation
AT = transpose(A);
oProd = outerProduct(v1, v2);
end ArrayFunctions5;
Is this issue known or should i report it to the trac?
Re: COMPILER BUG
Thank you for reporting this. It was quite easy to fix, so I've already fixed it. The fix should be in the next nightly build tomorrow.
- perost
- 114 Posts
Re: COMPILER BUG
Sanjay_Kamath wrote:
Can you tell me what caused this error?
The issue was that outerProduct was incorrectly typed in this case. Because of how the compiler is constructed this led to a situation where the compiler thought the types on both sides of the equation where different even though they were the same. Such cases are always compiler bugs, hence the error message.
- perost
- 114 Posts
Re: COMPILER BUG
Because the issue was caused by the compiler not knowing the type of the component references v1 and v2 at one point, and this caused it to assign the wrong type later on. {2, 1} and {3, 2} are array literals and much easier to type.
- perost
- 114 Posts
- Index
- » Programming
- » Modelica Language
- » COMPILER BUG