MATLAB seg fault during codegen

3 次查看(过去 30 天)
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