Clear Filters
Clear Filters

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)

46 views (last 30 days)
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

Answers (1)

Sivapriya Srinivasan
Sivapriya Srinivasan on 25 Apr 2023
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

Categories

Find more on Programmatic Model Editing in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!