Opened 11 years ago
Last modified 3 years ago
#2292 assigned defect
wrong generated C code
Reported by: | Adeel Asghar | Owned by: | Lennart Ochel |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Backend | Version: | trunk |
Keywords: | Cc: | bouzakariaahmed@…, Lennart Ochel |
Description
The compiler generate the wrong code for the following the algorithm,
temper[i]:=17 + temper[i];
The following C code is generated,
real_array_create(&tmp0, ((modelica_real*)&($Ptemper)), 1, 10); (*real_array_element_addr(&$Ptemper, 1, (modelica_integer)$Pi)) = (17.0 + (*real_array_element_addr(&tmp0, 1, (modelica_integer)$Pi)));
I believe it should be,
real_array_create(&tmp0, ((modelica_real*)&($Ptemper)), 1, 10); (*real_array_element_addr(&tmp0, 1, (modelica_integer)$Pi)) = (17.0 + (*real_array_element_addr(&tmp0, 1, (modelica_integer)$Pi)));
On the left hand side we should use &tmp0 instead of &$Ptemper.
The simulation executable segfaults.
The complete model is attached.
Attachments (1)
Change History (18)
by , 11 years ago
Attachment: | Sample_Vs_vector.mo added |
---|
comment:1 by , 11 years ago
Cc: | added |
---|
comment:2 by , 11 years ago
Milestone: | 1.9.0 → 1.9.1 |
---|
comment:3 by , 10 years ago
Component: | Code Generation → Backend |
---|---|
Owner: | changed from | to
Status: | new → assigned |
This ones also works in the meanwhile, although only with numerical initialization.
"Notification: The given system is mixed-determined. [index > 0] Notification: The given system is mixed-determined. [index > 1] Notification: The given system is mixed-determined. [index > 2] Notification: The given system is mixed-determined. [index > 3] Warning: No system for the symbolic initialization was generated. A method using numerical algorithms will be used instead. "
comment:4 by , 10 years ago
Milestone: | 1.9.1 → 1.9.2 |
---|
This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).
comment:5 by , 10 years ago
Milestone: | 1.9.2 → 1.9.3 |
---|
Milestone changed to 1.9.3 since 1.9.2 was released.
comment:10 by , 8 years ago
Milestone: | 1.11.0 → 1.12.0 |
---|
Milestone moved to 1.12.0 due to 1.11.0 already being released.
comment:11 by , 7 years ago
Milestone: | 1.12.0 → 1.13.0 |
---|
As of v1.13.0-dev-188-g2c5818d, the simulation no longer segfaults, but the generated code is still not correct: the temper
array is not updated as expected and there singular linear systems generated that should not be there.
comment:14 by , 5 years ago
Milestone: | 1.14.0 → 1.16.0 |
---|
Releasing 1.14.0 which is stable and has many improvements w.r.t. 1.13.2. This issue is rescheduled to 1.16.0
comment:16 by , 4 years ago
Milestone: | 1.17.0 → 1.18.0 |
---|
Retargeted to 1.18.0 because of 1.17.0 timed release.
Postponed until 1.9.1