[R] Error: value of 'SET_CXTAIL' must be a char or NULL, not a 'char'

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Apr 19 23:16:25 CEST 2008


I do think this is definitely an R-devel topic according to the posting 
guide, so I am not going to go into any details here.

However, the issue is fairly clearly a corrupt CHARSXP cache, the only 
place CXTAIL is used.

On Sat, 19 Apr 2008, Søren Højsgaard wrote:

> so it looks as though the error message is a little buggy (it should
> print TYPEOF(v), not TYPEOF(x), or maybe it should test x, not v.)   But
> I don't really know what it's doing.  Are you using a STRSXP somewhere
> that is expecting a CHARSXP?
>
> Duncan Murdoch
>
> No; the code that produces the error is given below; but it does not occur on every occasion...
> I am puzzled...
>
> Regards
> Søren
>
>
>
> SEXP rconipm(SEXP S, SEXP K, SEXP Glist, SEXP mode)
> {
>  R_len_t  nG=length(Glist);
>  SEXP ans, Sdims, Kdims,  Gitem, Giidims;
>  int  nrS, ncS, nrK, ncK, nrgen, ncgen, ii, jj, Gii, idx;
>  double *modep, *rS, *rK, *rG, *ansp, rans;
>  Sdims = getAttrib(S, R_DimSymbol);
>  nrS = INTEGER(Sdims)[0];  ncS = INTEGER(Sdims)[1];
>  rS  = REAL(S);
>  Kdims = getAttrib(K, R_DimSymbol);
>  nrK = INTEGER(Kdims)[0];  ncK = INTEGER(Kdims)[1];
>  rK  = REAL(K);
>  PROTECT(ans = allocVector(REALSXP,nrK*ncK));
>  ansp = REAL(ans);
>  PROTECT(mode = coerceVector(mode, REALSXP)) ;
>  modep = REAL(mode);
>  idx = 0;
>  for (Gii=0; Gii<nG; Gii++){
>    Rprintf("Generator %i\n", Gii);
>    Gitem   = VECTOR_ELT(Glist, Gii);
>    Giidims = getAttrib(Gitem, R_DimSymbol);
>    nrgen   = INTEGER(Giidims)[0];
>    ncgen   = INTEGER(Giidims)[1];
>
>    rG = REAL(Gitem);
>    //printmatd(rG, &nrgen, &ncgen);
>    //modnewton(rS, rK, &nrS, rG, &nrgen, &ncgen);
>  }
>
>  UNPROTECT(2);
>  return(ans);
> }
>
>
> ________________________________
>
> Fra: Duncan Murdoch [mailto:murdoch at stats.uwo.ca]
> Sendt: lø 19-04-2008 20:05
> Til: Søren Højsgaard
> Cc: r-help at stat.math.ethz.ch
> Emne: Re: [R] Error: value of 'SET_CXTAIL' must be a char or NULL, not a 'char'
>
>
>
> On 19/04/2008 1:18 PM, Søren Højsgaard wrote:
>> Dear List
>> On windows XP using R.2.6.2 I get the message
>>
>> Error: value of 'SET_CXTAIL' must be a char or NULL, not a 'char'
>>
>> in connection with calling C code (using the .Call interface). I have been unable to find any info on this (in Writing R extensions). Can anyone help me with understanding this error? (In case it helps in tracking the problem: I pass two matrices and a list of several matrices to my C function).
>
> The code that produces that error message is in memory.c:
>
> #ifdef USE_ATTRIB_FIELD_FOR_CHARSXP_CACHE_CHAINS
> SEXP (SET_CXTAIL)(SEXP x, SEXP v) {
> #ifdef USE_TYPE_CHECKING
>     if(TYPEOF(v) != CHARSXP && TYPEOF(v) != NILSXP)
>        error("value of 'SET_CXTAIL' must be a char or NULL, not a '%s'",
>              type2char(TYPEOF(x)));
> #endif
>     /*CHECK_OLD_TO_NEW(x, v); *//* not needed since not properly traced */
>     ATTRIB(x) = v;
>     return x;
> }
> #endif /* USE_ATTRIB_FIELD_FOR_CHARSXP_CACHE_CHAINS */
>
> so it looks as though the error message is a little buggy (it should
> print TYPEOF(v), not TYPEOF(x), or maybe it should test x, not v.)   But
> I don't really know what it's doing.  Are you using a STRSXP somewhere
> that is expecting a CHARSXP?
>
> Duncan Murdoch
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


More information about the R-help mailing list