Unexpected or internal error encountered in "in CGIR: b:\matlab\​src\cg_ir\​factory\co​nstfactory​.cpp line 1136: In enumConst: Assertion failed: aType->ord​inalIsInRa​nge(aOrdin​al)

59 次查看(过去 30 天)
Context: Matlab/Simulink environment is being used to generate C-code for a given simulink model ('.SLX' file). The following is the configuration.
Configuration:
MATLAB Architecture : win64
MATLAB Root : C:\Program Files\MATLAB\R2020a
MATLAB Version : 9.8.0.1873465 (R2020a) Update 8
Operating System : Microsoft Windows 10 Enterprise, Version 21H2 (Build 19044.2846)
Processor : Intel(R) Xeon(R) W-2125 CPU @ 4.00GHz 4.01 GHz
When I tried to generate the C-code for the simulink model I experience the following compilation error.
CGIR assertion 'In enumConst: Assertion failed: aType->ordinalIsInRange(aOrdinal)' failed in 'b:\matlab\src\cg_ir\factory\constfactory.cpp:1136'
[ 0] 0x00007ffa82cad402 C:\Program Files\MATLAB\R2020a\bin\win64\rtwcg.dll+05559298 SLCG::Pass::InlineConstConfig::operator=+00012530
[ 1] 0x00007ffa82cab55c C:\Program Files\MATLAB\R2020a\bin\win64\rtwcg.dll+05551452 SLCG::Pass::InlineConstConfig::operator=+00004684
[ 2] 0x00007ffa82cab8c3 C:\Program Files\MATLAB\R2020a\bin\win64\rtwcg.dll+05552323 SLCG::Pass::InlineConstConfig::operator=+00005555
[ 3] 0x00007ffa82cae0c2 C:\Program Files\MATLAB\R2020a\bin\win64\rtwcg.dll+05562562 SLCG::Pass::InlineConstConfig::getSkipDeadCodeElimination+00002146
[ 4] 0x00007ffa83c6d002 C:\Program Files\MATLAB\R2020a\bin\win64\cgir_support.dll+03330050 CG::ScopeTransform::apply+00000098
[ 5] 0x00007ffa82e61ee2 C:\Program Files\MATLAB\R2020a\bin\win64\rtwcg.dll+07347938 SLCG::Pass::Driver::execute+00000898
[ 6] 0x00007ffa82e5e906 C:\Program Files\MATLAB\R2020a\bin\win64\rtwcg.dll+07334150 SLCG::Pass::Driver::addTransform+00000054
[ 7] 0x00007ffa9a0b0b89 C:\Program Files\MATLAB\R2020a\bin\win64\slcg_driver.dll+00068489 load_slcg_driver+00005753
[ 8] 0x00007ffa9a0b01c0 C:\Program Files\MATLAB\R2020a\bin\win64\slcg_driver.dll+00065984 load_slcg_driver+00003248
[ 9] 0x00007ffa9a0c388a C:\Program Files\MATLAB\R2020a\bin\win64\slcg_driver.dll+00145546 load_slcg_driver+00082810
[ 10] 0x00007ffa9a0c78d7 C:\Program Files\MATLAB\R2020a\bin\win64\slcg_driver.dll+00162007 load_slcg_driver+00099271
[ 11] 0x00007ffa82e73a28 C:\Program Files\MATLAB\R2020a\bin\win64\rtwcg.dll+07420456 SLCG::Pass::optimizeAndEmitCodePhase2+00000456
[ 12] 0x00007ffa82d22e13 C:\Program Files\MATLAB\R2020a\bin\win64\rtwcg.dll+06041107 RTWCG::RTWCGModule::OptimizeAndEmitCodePhase2+00000131
[ 13] 0x00007ffa8e435ceb C:\Program Files\MATLAB\R2020a\bin\win64\libmwsimulink.dll+10116331 ouRequestBlockReduction+00615467
[ 14] 0x00007ffa8e428bf8 C:\Program Files\MATLAB\R2020a\bin\win64\libmwsimulink.dll+10062840 ouRequestBlockReduction+00561976
[ 15] 0x00007ffa8e489435 C:\Program Files\MATLAB\R2020a\bin\win64\libmwsimulink.dll+10458165 RTWCG::RTWContextImpl::PopulateVarGroupIF::useRootOutportBuffer+00222325
### Build procedure for FCM150_ASW_CathSubSys_2020a aborted due to an error.
Unexpected or internal error encountered in "in CGIR: b:\matlab\src\cg_ir\factory\constfactory.cpp line 1136: In enumConst: Assertion failed: aType->ordinalIsInRange(aOrdinal)
". Please report this to MathWorks if you can cause it to recur
Could anyone of you give me your suggestions about how to resolve the above-menitoned compilation error?
Best regards,
Sriniwas Maddukuri

回答(1 个)

Sivapriya Srinivasan
Hello Sriniwas,
The error message shows that there is an internal error in the code generation process of the Simulink model .
The error occurred in a file named constfactory.cpp at line 1136, where assertion failed in the CGIR phase(code generation intermediate representation)
Without looking at the Simulink model, it is difficult to identify the exact cause of the error. However, you can try the following steps to resolve the issue:
1.Upgrade to the latest version of MATLAB and Simulink, if possible.
2.Check if there are any unsupported blocks in your model. Remove any such blocks and try generating the code again.
3.Try generating the code with a different configuration or settings.
4.Check if there are any errors or warnings in the Simulink model. Fix them and try generating the code again.
5.Try generating the code on a different machine or OS to isolate the issue
https://servicerequest.mathworks.com/mysr/cp_case_new1?cc=us for further assistance

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

产品


版本

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by