Opened 11 years ago

Closed 11 years ago

#2399 closed defect (fixed)

array assignment does not work properly

Reported by: Adeel Asghar Owned by: Willi Braun
Priority: blocker Milestone: 1.9.1
Component: Backend Version: trunk
Keywords: Cc: Lennart Ochel, Willi Braun

Description

Create a libmylib.a from mylib.c file,

gcc -c mylib.c -o mylib.o
ar rcs libmylib.a mylib.o

Copy the lib to trunk/build/lib/.

Run the attached model.
Check the attached output file. Note that the value of outputs2[1] is zero whereas it should be same as outputs[1].

In the model the equation for getting the values of outputs1 array is,

(outputs1) := calculate1(step, size(outputs1, 1));

and for outputs2 array is,

(outputs2, done) := calculate2(step, size(outputs2, 1));

the only difference is that for outputs2 an additional output done is specified. The code works fine if only one output is used.

There are two functions in the mylib.c file but both are doing the same thing.

Attachments (5)

test.mo (1.0 KB ) - added by Adeel Asghar 11 years ago.
Model
test.mos (92 bytes ) - added by Adeel Asghar 11 years ago.
script
mylib.c (777 bytes ) - added by Adeel Asghar 11 years ago.
M_res.csv (35.7 KB ) - added by Adeel Asghar 11 years ago.
foo.mo (2.0 KB ) - added by Lennart Ochel 11 years ago.

Download all attachments as: .zip

Change History (11)

by Adeel Asghar, 11 years ago

Attachment: test.mo added

Model

by Adeel Asghar, 11 years ago

Attachment: test.mos added

script

by Adeel Asghar, 11 years ago

Attachment: mylib.c added

by Adeel Asghar, 11 years ago

Attachment: M_res.csv added

comment:1 by Adeel Asghar, 11 years ago

Priority: highblocker

comment:2 by Martin Sjölund, 11 years ago

Resolution: duplicate
Status: newclosed

I believe this is a duplicate of #2352

comment:3 by Mahder Alemseged Gebremedhin, 11 years ago

Resolution: duplicate
Status: closedreopened

comment:4 by Martin Sjölund, 11 years ago

Milestone: 1.9.01.9.1

Postponed until 1.9.1

comment:5 by Lennart Ochel, 11 years ago

Owner: changed from probably noone to Willi Braun
Status: reopenedassigned
1: done:DISCRETE() .foo, .Integer type: Integer 
2: outputs2[2]:DISCRETE() .foo, .Real type: Real [2]
3: outputs2[1]:VARIABLE() .foo, .Real type: Real [2]
4: outputs1[2]:DISCRETE() .foo, .Real type: Real [2]
5: outputs1[1]:DISCRETE() .foo, .Real type: Real [2]
6: $whenCondition1:DISCRETE(fixed = true )  type: Boolean 

output2 gets not marked as discrete variable.

by Lennart Ochel, 11 years ago

Attachment: foo.mo added

comment:6 by Willi Braun, 11 years ago

Resolution: fixed
Status: assignedclosed

fixed in r17994.

Note: See TracTickets for help on using tickets.