Error: Excessive recursion at instantiation


In my project i’m using Eigen libraries, and this files uses templates. When i run my project with gcc i get no errors. Although, when i run it with pgcc / pgc++ i get this errors:

excessive recursion at instantiation of function
          ing<Kernel, Index, Stop>::run

the template that is generation the error looks like this:

template<typename Kernel, int Index, int Stop>
  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel& kernel)
    copy_using_evaluator_LinearTraversal_CompleteUnrolling<Kernel, Index+1, Stop>::run(kernel);

template<typename Kernel, int Stop>
struct copy_using_evaluator_LinearTraversal_CompleteUnrolling<Kernel, Stop, Stop>
  EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&) { }

Because it it eigen libraries, i can’t even change the code, everything should work fine. I think the problem is because of the limit that pgc uses to recursive functions.

I can’t find any flag that we can use to change this limit, for example, in gcc we can do “-ftemplate-depth=limit”. Is there a flag like this on pgc to use? It would be very useful. Probably there is no error on the code, i just need more iteration. Would be awesome if you could implement that flag.


Hi Caap,

Try: “-Wc,–pending_instantiations=N”

Where N is the maximum number of recursive template instantiations, or 0 for unlimited. The default value, without this option, is 64.
(That’s a single hyphen before the ‘W’, and a double hyphen before ‘pending’.)