MATLAB seg fault during codegen

4 ビュー (過去 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 Center および File ExchangeMATLAB Coder についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by