MATLAB seg fault during codegen

조회 수: 3 (최근 30일)
Chuck37
Chuck37 2014년 10월 24일
편집: Ryan Livingston 2014년 10월 24일
It's not unusual for codegen to generate code that will seg fault, but I now have a case where I get a seg fault during codegen operation (could be the compiler? I'm not sure how to tell). It comes and goes depending on whether I add a particular argument to the function, which is a simple vector input. Any ideas what to look for? I'm generating mex by the way, on linux.

채택된 답변

Ryan Livingston
Ryan Livingston 2014년 10월 24일
편집: Ryan Livingston 2014년 10월 24일
If you are seeing a seg fault during code generation, the recommended action is to contact technical support:
for assistance.
You can try using the generate code only option to codegen to skip the step of the C compiler:
codegen foo -args {1} -c
That flag causes the code to be generated but not compiled. It corresponds to the GenCodeOnly option on a config object returned from coder.config:
As regards seg faults in the generated code, the most common cause of generated code that behaves unexpectedly is the usage of constructs which are not supported for code generation. Growing arrays by indexing an example of such a construct.
Typically, when such misbehaviors are seen, if a MEX function were to be generated and executed with the same inputs, a runtime error will occur that alerts the user to the presence of a construct in the source MATLAB code that is erroneous for code generation.
The next thing to investigate if there are seg faults when running the generated MEX would be any calls to external C code using coder.ceval.
If the generated MEX is not issuing an error, the coder.ceval calls are proper and seg faults are still seen, you could post a MATLAB example that reproduces it. Also, reporting to MathWorks Technical Support so the issue may be investigated is a good idea.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Coder에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by