Opened 8 years ago

Closed 8 years ago

#4382 closed defect (fixed)

Array operators .- .+ fail

Reported by: jens.schoenbohm@… Owned by: Lennart Ochel
Priority: normal Milestone: 1.12.0
Component: MetaModelica Version:
Keywords: array, operator, scalar Cc:

Description

The operators .- and .+ give an error or wrong results as one can see in the example below. The result of the operation is shown as comment after the expression.

function main
  protected
	Real m[:];
	String str;
	Real b[:];
  algorithm
	m := array(1.0,2.0,3.0,4.0);
	b := m .+ 10.0; // 10 20 30 40
	b := m .- 10.0; // -10 -20 -30 -40
	b := 10.0 .+ m; // 10 20 30 40
	b := 10.0 .- m; // Template error: Code generation does not support SUB_SCALAR_ARRAY 10.0 .- m.
  end main;

Change History (4)

comment:1 by Lennart Ochel, 8 years ago

It seems that this only fail if the symbolic function evaluation is turned off.

comment:2 by Lennart Ochel, 8 years ago

The wrong results will be fixed with OMCompiler#1597.

comment:3 by Lennart Ochel, 8 years ago

Owner: changed from Martin Sjölund to Lennart Ochel
Status: newaccepted

comment:4 by Lennart Ochel, 8 years ago

Milestone: Future1.12.0
Resolution: fixed
Status: acceptedclosed

I've fixed also the missing case for SUB_SCALAR_ARRAY and added the example to the test suite (see OpenModelica-testsuite#615).

Note: See TracTickets for help on using tickets.