"Peter A. Felvegi" <pets...@praire-chicken.com> writes: > My question is: wouldn't it be possible to print a warning when a jmp > to itself or trivial infinite recursion is generated? The code > compiled fine w/ -Wall -Wextra -Werror w/ 4.6 and 4.7.
This question is not appropriate for the mailing list gcc@gcc.gnu.org, which is for discussions about the development of GCC. It would be appropriate for gcc-h...@gcc.gnu.org. Please take any followups to gcc-help. Thanks. I'm not yet convinced that a -Wall warning would be worth the effort in this case. You have basically come up with a complicated way to write void f() { f(); } I suppose I think it would be reasonable to issue a -Wall warning for code like that. The trick is detecting it. Obviously there is nothing wrong with a recursive call. What is different here is that the recursive call is unconditional. I don't see a way to detect that without writing a specific warning pass to look for that case. And I think this case is rare enough, and easy enough to discover in other ways, that I don't think a warning would be worth the cost in compilation time and compiler maintenance. If the problem can be detected cheaply in the course of an existing pass, I would support a warning. Ian