Notes |
|
(0033785)
|
David Cole
|
2013-09-05 07:35
|
|
A C program would also crash when called in such a manner...
How is this a CMake bug?
If you are writing a function, it's up to you to make sure any recursion is not infinite... |
|
|
(0033786)
|
Magnus Johansson
|
2013-09-05 07:57
|
|
CMake could detect this similarily to 0013822, and give a more descriptive error than "segmentation fault". This mistake was a pain to find in project with more than 150 CMakeLists.txt files.
From a note on 0013822:
"CMake should track the call stack depth and limit it so that this case fails with an error instead of crashing." |
|
|
(0033787)
|
David Cole
|
2013-09-05 08:45
|
|
What's a reasonable limit? |
|
|
(0033788)
|
Magnus Johansson
|
2013-09-05 09:27
|
|
I have yet to see a case where a recursive cmake function is necessary. But then again, I've so far only used cmake in one project. For our purposes, no recursion at all is sufficient. I'm not experienced enough with cmake to have an idea of a reasonable limit in general. |
|
|
(0033789)
|
David Cole
|
2013-09-05 13:27
|
|
This cmake -P script:
function(intentionally_recurse_for_no_reason level)
message("level='${level}'")
math(EXPR level "${level} + 1")
intentionally_recurse_for_no_reason(${level})
endfunction()
intentionally_recurse_for_no_reason(0)
...runs for 17,393 iterations using CMake 2.8.12-rc1 before it crashes.
If CMake developers were to do anything to address this bug, perhaps it should be by detecting the depth of the function call stack, and giving some sort of warning, or perhaps even an error, if it exceeds some limit between 5,000 and 15,000.
The problem is this:
If the chosen limit is too small, it may be hit in normal processing. If it's too high, then CMake will crash anyway on platforms where the stack is not as big as it is in my one test case here. |
|
|
(0042360)
|
Kitware Robot
|
2016-06-10 14:29
|
|
Resolving issue as `moved`.
This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
|