Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#5658 closed defect (fixed)

Wrong error message when using some built-in function (abs, mod) with undefined variables as arguments

Reported by: Pierre Haessig <pierre.haessig@…> Owned by: somebody
Priority: low Milestone: 1.14.0
Component: *unknown* Version: v1.13.2
Keywords: Cc:

Description

Dear Maintainers,

On OM version 1.13.2, I get wrong error messages when I use some built-in functions with undefined variables as arguments. Here is a minimal example.

model ModelUndefVarBug
 Real x;
equation

x = abs(a);

end ModelUndefVarBug;

Checking this model in OMEdit yields a translation error (this is expected) which erroneously complains that abs is undefined (although true the problem is that variable a is not defined):

[ModelUndefVarBug: 5:1-5:11]: No matching function found for abs in component <NO COMPONENT>
candidates are .OpenModelica.Internal.intAbs<function>(Integer v) => Integer
 -.OpenModelica.Internal.realAbs<function>(Real v) => Real

The same problem appears with the mod function, but not with most others. For example, if I replace the equation with x = sin(a);, I get an expected translation error message:

[ModelUndefVarBug: 5:1-5:11]: Variable a not found in scope ModelUndefVarBug.

I don't know if other functions are affected. I tested quite a few from Modelica 3.4 spec, §3.7 (Built-in Intrinsic Operators with Function Syntax). mod and abs are the only one I found affected, but my test was not exhaustive.

Although a minor issue, this type of wrong error message makes debugging Modelica models harder than it needs.

Best,
Pierre

Change History (3)

comment:1 by anonymous, 5 years ago

Use the new front-end

comment:2 by Francesco Casella, 5 years ago

Milestone: Future1.14.0
Resolution: fixed
Status: newclosed

Try the latest 1.14.0 nightly build, which uses the new front-end by default in OMEdit. The following message is returned:

[1] 02:00:34 Translation Error
[ModelUndefVarBug: 5:1-5:11]: Variable a not found in scope ModelUndefVarBug.

comment:3 by Pierre Haessig <pierre.haessig@…>, 5 years ago

Thanks for the feedback!

Note: See TracTickets for help on using tickets.