#5111 closed defect (fixed)
Got COMPILER BUG when compiling Modelica_Requirements (minimal example attached)
Reported by: | Owned by: | somebody | |
---|---|---|---|
Priority: | normal | Milestone: | Future |
Component: | *unknown* | Version: | v1.13.0-dev-nightly |
Keywords: | Cc: |
Description
When compiling examples from the Modelica_Requirements library, I got the COMPILER BUG message. The example was then reduced to quite strangely looking model with setting pre() of a variable of enum type inside the initial equation
. Not sure whether this is a correct Modelica code, but compiler asked to send a bug report. :)
How to reproduce
Take the following TestEnum.mo
:
model TestEnum type Property = enumeration(Undecided); Property localProperty; initial equation pre(localProperty) = Property.Undecided; end TestEnum;
And try to process it:
$ omc --version OpenModelica 1.13.0~dev-1409-gd2ab68c $ omc TestEnum.mo Error processing file: TestEnum.mo [/home/trosinenko/TestEnum.mo:5:3-5:42:writable] Error: Got type mismatch error, but matching types enumeration(Undecided). This is a ***COMPILER BUG***, please report it to https://trac.openmodelica.org/OpenModelica. Error: Error occurred while flattening model TestEnum # Error encountered! Exiting... # Please check the error message and the flags. Execution failed!
What is expected
The model is either compiled or rejected with an explanation, without COMPILER BUG message.
Change History (2)
comment:1 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 6 years ago
I have tested it with some Modelica_Requirements examples -- most of them can be compiled and simulated now, some don't, but with meaningful error messages -- maybe errors in library. Thank you for blazingly fast fix!
Fixed in baede2f.
The actual issue was that the old frontend had a special case for
component_reference = enum_expression
in the part of the instantiation that handles equations, but no other cases involving enums. So e.g.:I don't know why it was implemented like that, but I added the missing cases and it seems to work just fine.