New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uninitialized fields of record outputs of functions #1628
Comments
Comment by hubertus on 10 Dec 2014 18:50 UTC This code was created when Modelica was at version 1.6 and never updated, keep that in mind. I think that all fields should be initialized, so this could be filed as a but for MSL. In this particular case it would be great to have a symbolic UNDEFINED, as has been discussed elswehere. What to do with such record entries is maybe worthwhile discussing in the language group. It may be an option to leave it without assignment, I'd prefer to set a symbolic undefined. Hubertus |
Comment by jmattsson on 11 Dec 2014 08:34 UTC The same issue occures in |
Comment by hansolsson on 23 Feb 2015 17:19 UTC The Modelica function should assign to the entire output, including all fields of it (excluding empty arrays - i.e. all elements of the array should be assigned, not the array). A tool could use NaN, and invalid pointer for strings to be able to detect it (not as easy for Boolean, Integer, and Enumeration - could use invalid values for Boolean and Enumeration). On the other hand to just run predictably it is better to use zero/empty string/false. |
Modified by beutlich on 19 Mar 2015 09:49 UTC |
Modified by stefanv on 30 Sep 2015 11:57 UTC |
Comment by hubertus on 13 Dec 2015 01:38 UTC |
Changelog modified by hubertus on 13 Dec 2015 01:38 UTC |
Reported by stefanv on 10 Dec 2014 17:34 UTC
Modelica.Media.Water.waterBaseProp_pT returns a record of type Modelica.Media.Common.IF97BaseTwoPhase.
The function handles four different "regions", and in the if-statement branches for those, it doesn't always assign all of the fields of the output record.
Does that make it an incorrect function? If not, what are the returned values of those fields?
Here's a simplified example:
For the call,
r = F(1)
, what is the value ofr.a
?Migrated-From: https://trac.modelica.org/Modelica/ticket/1628
The text was updated successfully, but these errors were encountered: