when i compile code with armcl.exe,if there are recursive functions in my code, the compile will pause.
if armcl can support compile recursive functions, what should i do?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
when i compile code with armcl.exe,if there are recursive functions in my code, the compile will pause.
if armcl can support compile recursive functions, what should i do?
I'm not sure what this ...
the compile will pause.
means. Please describe what you see, in detail, and describe what you expect to see instead. For one source file where this behavior occurs, please follow the directions in the article How to Submit a Compiler Test Case.
I can make some general comments about how any compiler, including armcl, handles recursion. When a function calls itself, directly or indirectly, that is handled just like any other function call. No special handling occurs. It is up to the programmer to write the code such that the recursion somehow ends at runtime. If that step is done incorrectly, the compiler does not detect it, or issue any diagnostics.
Thanks and regards,
-George
Hi, thank you for your help. I add some information of compile to you
1.compile pause here, in Spi_Priv.o
2.then i press ctrl+c,it report err in IA_Interface_10ms.o
3. 1 and 2 is the result, then i analyze IA_Interface_10ms.c, i find a recursive function call affects compilation.
If i don't call this recursive function ,the compile will be success
some compile flags are: -c -qq -pdsw225 -ms -O4 -s
The IA_Interface_10ms.c is generated by simulink, i can't write the similar test code to offer to you, sorry
4. then i find some intermediate files don't generate when i compile IA_Interface_10ms.c, show you the other C file's intermediate files
the IA_Interface_10ms.c has two files, the other has six files
5. I hope the information above is useful to you to analyze, thank you very much
It looks like you're building with -o4. This triggers link-time optimization LTO, which could mean that the link takes a significant amount of time to complete -- this depends on the code, but it shouldn't ever pause indefinitely. As George said, recursive calls are treated just like regular calls. I would recommend trying to build at a lower optimization level (-o3) to verify that the compile/link succeeds. At -o4, you may need to give it more time to complete before interrupting the build.
Beyond that, there's very little we can diagnose without an actual test case that reproduces the problem. If there's anyway you could take the simulink code and reduce it down such that it could be reproduced, then we can look at that.
Thanks
thank you, I have tried -O3, it didn't work too, the reduced code of simulink I don't know how to write, so I can't help, sorry
Hi -- My suggestion would be to keep reducing the optimization level. At the very least, you've proven that the issue isn't related to link-time optimization. Since the compiler doesn't do anything special with recursive functions, we can only speculate that the issue here is something indirectly related to the recursive function being included and not the fact that it is recursive. But without a test case, we can't do any testing. I would also suggest reducing the recursive function down until you no longer see the issue in the compiler, and that may yield more insight into what is going on.
Beyond that, you could try building a project with a similar recursive function and see if you can get it to produce the same behavior.