Opened 13 years ago

Last modified 13 years ago

#1583 closed defect (fixed)

array bug, independent of types

Reported by: jlettau Owned by: jlettau
Priority: blocker Milestone:
Component: Version:
Keywords: Cc: jlettau,

Description

Hello!

When I run the makefile of the attached "array_bug.mo"-file I get the following error message:

"
gcc  -O3 -falign-functions -msse2 -mfpmath=sse   -I"F:/workspace/OpenModelica/build//include/omc" -I.    -c -o lastrange.o lastrange.c
lastrange.c: In function `residualFunc3':
lastrange.c:322: error: conversion to non-scalar type requested
lastrange.c:324: error: conversion to non-scalar type requested
lastrange.c:326: error: invalid operands to binary -
lastrange.c:343: error: conversion to non-scalar type requested
lastrange.c:345: error: conversion to non-scalar type requested
lastrange.c:347: error: invalid operands to binary -
lastrange.c:364: error: conversion to non-scalar type requested
lastrange.c:366: error: conversion to non-scalar type requested
lastrange.c:368: error: invalid operands to binary -
lastrange.c:386: error: conversion to non-scalar type requested
lastrange.c:388: error: conversion to non-scalar type requested
lastrange.c:390: error: invalid operands to binary -
make: *** [lastrange.o] Error 1
"

this error message doesn`t depend on types. With Booleans it appears also.

// name:     strange_bug.mo
// keywords: mixed nonlinear problem
// status:   incorrect
// 
// 
function f
  input Real t;
  input Boolean i[2];
  output Boolean o[2];
algorithm
  o := if t > 0.5 then {not i[1],not i[2]} else {true,true};
end f; 

function fR
  input Real t;
  input Real i[2];
  output Real o[2];
algorithm
  o := if t > 0.5 then {sin(t)*i[1],sin(t)*i[2]} else {1.0,2.0};
end fR; 
 
model lastrange
  parameter Integer nIn = 2;
  Real bh[nIn];
  Real barr[nIn];
 equation
    barr = if sin(time)>0 then fR(0,bh) else fill(1.0,nIn);
    bh = if sin(time)<0 then fR(time,barr) else fill(3.0,nIn);
end lastrange; 

Attachments (1)

array_bug.mo (628 bytes ) - added by jlettau 13 years ago.

Download all attachments as: .zip

Change History (4)

by jlettau, 13 years ago

Attachment: array_bug.mo added

comment:1 by Martin Sjölund, 13 years ago

Fixed formatting

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

File short enough to be in the description

comment:3 by Martin Sjölund, 13 years ago

Fixed in trunk (r9585) with this example added as testsuite/mosfiles/ASubIfExp.mos

Note: See TracTickets for help on using tickets.