https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68230
--- Comment #12 from Martin Jambor <jamborm at gcc dot gnu.org> --- (In reply to Eric Gallager from comment #10) > Martin Jambor's IPA-SRA rewrite might be relevant here; it sounded like the > new IPA-SRA will remove parameters that are unused like this, but I didn't > quite catch if it'd also warn about them... IPA-SRA can remove parameters that are only used to be passed to another function in a chain of recursive calls, it does not even have to be a direct recursion (but it can). It does not warn but it could. One problem is however that IPA-SRA only modifies and analyzes "local" functions, so in non-LTO mode it only works if all of the recursive functions were static or in an anonymous C++ namespace. With LTO, anything not exported outside the result executable/shared object would do but you'd only get your warnings at link-time. Please also note that with this particular testcase, by the time IPA passes see the function the recursion is converted to tail-call and since IPA-CP (running just before IPA-SRA) can also remove totally unused parameters, IPA-SRA does not do anything in this case even with -fwhole-program.