MATLAB: Does MATLAB Coder 2.0 (R2011a) crash when generating code that contains Simulink enumerated data types

codercrashenumenumeratedMATLABmatlab codersimulink

I am generating C code from MATLAB using MATLAB Coder 2.0 (R2011a). However, when my code contains an Simulink enumerated data type created by using the 'Simulink.defineIntEnumType()' command, I get the following crash:
Abnormal termination:
Segmentation violation
Register State (from fault):
EAX = 00000001 EBX = 7245943f
ECX = 11ac6978 EDX = 723afa30
ESP = 00c28a94 EBP = 00c28b20
ESI = 00000001 EDI = 7db59d50
EIP = 044b4121 EFL = 00010202
CS = 0000001b DS = 00000023 SS = 00000023
ES = 00000023 FS = 0000003b GS = 00000000
Stack Trace (from fault):
[ 0] 0x044b4121 C:/Program Files/MATLAB/R2011a/bin/win32/cg_ir.dll+00540961 ( CG::EnumTypeBuilder::loadMCOSDefinition+000801 )
[ 1] 0x726710b4 C:/Program Files/MATLAB/R2011a/bin/win32/eml.dll+01380532 ( MLInitialize_eml+136724 )
[ 2] 0x72670fe2 C:/Program Files/MATLAB/R2011a/bin/win32/eml.dll+01380322 ( MLInitialize_eml+136514 )
[ 3] 0x725d6bd7 C:/Program Files/MATLAB/R2011a/bin/win32/eml.dll+00748503 ( EML::FatalException::operator=+406551 )
[ 4] 0x725e34d1 C:/Program Files/MATLAB/R2011a/bin/win32/eml.dll+00799953 ( EML::FatalException::operator=+458001 )
[ 5] 0x725e5ca2 C:/Program Files/MATLAB/R2011a/bin/win32/eml.dll+00810146 ( EML::FatalException::operator=+468194 )
...

Best Answer

This bug was resolved in MATLAB Coder 2.1 (R2011b).
For older versions, there are no workarounds.
Related Question