Skip to content

bug in compiling dchisq #147

@paciorek

Description

@paciorek
     go = nFunction(
        fun = function() {
            y <- dchisq(3.1,1.0)
          return(y)
        },
        returnType = 'numericScalar'
      )
cgo <- nCompile(go)
/accounts/vis/paciorek/R/x86_64-pc-linux-gnu-library-ubuntu-24.04/4.5/nCompiler/include/nCompiler/ET_ext/post_Rcpp/recyclingRule.h:1258:20: error: too many arguments to function ‘double Rf_dchisq(double, double, int)’
 1258 |       return R_NAME(args...);                                                  \
      |                    ^
/accounts/vis/paciorek/R/x86_64-pc-linux-gnu-library-ubuntu-24.04/4.5/nCompiler/include/nCompiler/ET_ext/post_Rcpp/recyclingRule.h:1272:5: note: in expansion of macro ‘R_WRAPPER’
 1272 |     R_WRAPPER(dchisq, Rf_dchisq)
      |     ^~~~~~~~~
In file included from /system/linux/lib/R-24.04/4.5.0/x86_64/site-library/Rcpp/include/RcppCommon.h:76,
                 from /accounts/vis/paciorek/R/x86_64-pc-linux-gnu-library-ubuntu-24.04/4.5/nCompiler/include/nCompiler/nCompiler_omnibus_pre_Rcpp.h:26:
/usr/share/R/include/Rmath.h:227:25: note: declared here
  227 | #define dchisq          Rf_dchisq
      |                         ^~~~~~~~~
/usr/share/R/include/Rmath.h:438:9: note: in expansion of macro ‘dchisq’
  438 | double  dchisq(double, double, int);
      |         ^~~~~~

Here's the core generated C++:

flex_(y) = nCompiler::scalarArgDist::dchisq(3.1, 1.0, 0.0, false);

So it looks like we are not handling ncp or log correctly in some way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions