<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto"><div>This looks like a protection issue. </div><div><br></div><div>For whomever this makes sense to: From the code that wraps such object, i would investigate the call to setAttrib. </div><div><br></div><div>Perhaps we are supposed to get the result of it and protect it. <br><br>So i would tend to use an Armor instead of a Shield. </div><div><br></div><div>Romain</div><div><br>Le 28 mai 2014 à 16:02, John Mous <<a href="mailto:john.mous0@gmail.com">john.mous0@gmail.com</a>> a écrit :<br><br></div><blockquote type="cite"><div><div dir="ltr">Hmm, unfortunately the GitHub version failed also. The attributes on the failed object are a little different though, here's what they look like:<br><br>Browse[1]> str(results)<br> atomic [1:4] 1 1 2270 0<br>
 - attr(*, "")= symbol sim<br> - attr(*, "value")= promise to  NULL<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 27, 2014 at 6:10 PM, John Mous <span dir="ltr"><<a href="mailto:john.mous0@gmail.com" target="_blank">john.mous0@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Kevin,<br><br>Thanks. I will give the GitHub version a try -- the error usually manifests only after running for about a day or so, so it may take a while to do that. Unfortunately I am having trouble creating a small reproducible example -- a function with just the assignments as written in my previous e-mail works fine when executed thousands of times in a loop. The full  code is not that long (~165 lines), but is also non-trivial. <br>

<br>It's odd that something else is causing things to fail with the end result being that only the field *names*, which are hardcoded, and not the values, not coming through properly. Since you said you suspect the problem may be fixed, can you give me a hint of what you think it may be related to? This might help me isolate the piece of offending code.<br>

<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 27, 2014 at 5:46 PM, Kevin Ushey <span dir="ltr"><<a href="mailto:kevinushey@gmail.com" target="_blank">kevinushey@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi John,<br>
<br>
I think we may have tackled this in some of the latest fixes with the<br>
version of Rcpp on GitHub. Can you try installing that version and<br>
trying again? Ie, try<br>
<br>
    install.packages(devtools); devtools::install_github("RcppCore/Rcpp")<br>
<br>
then try running your code again.<br>
<br>
Alternatively, please supply a small reproducible example that we can<br>
try to run ourselves. You may be able to tease this error out<br>
reproducibly if you run it with gctorture(TRUE) on.<br>
<br>
Thanks,<br>
Kevin<br>
<div><div><br>
On Tue, May 27, 2014 at 2:42 PM, John Mous <<a href="mailto:john.mous0@gmail.com" target="_blank">john.mous0@gmail.com</a>> wrote:<br>
> Hello,<br>
><br>
> I am passing back a very simple std::map<std::string, int> from Rcpp as<br>
> follows:<br>
><br>
> std::map<std::string, int> result;<br>
> result["X1"] = X1;<br>
> result["X2"] = X2;<br>
> result["X3"] = X3;<br>
> result["X4"] = X4;<br>
> return wrap(result);<br>
><br>
> The keys are hardcoded as shown, and the values X1-X4 are ints. Almost<br>
> always everything works fine, however, very intermittently, a vector is<br>
> returned on the R side _without_ named fields. For example:<br>
><br>
> Browse[1]> results<br>
> [1]   1   2 863   0<br>
> Error during wrapup: 'getCharCE' must be called on a CHARSXP<br>
> Browse[1]> str(results)<br>
>  atomic [1:4] 1 2 863 0<br>
>  - attr(*, "")= symbol X1<br>
>  - attr(*, "")= language `[[<-`(`*tmp*`, sim, value = 1L)<br>
><br>
> results[[X1]] works, but results[["X1"]] does not, and X2-X4 can be<br>
> retrieved only by index. However, again, most runs are successful:<br>
><br>
> Browse[1]> results<br>
>  X1  X2  X3  X4<br>
>    1    1 3254    0<br>
> Browse[1]> str(results)<br>
>  Named int [1:4] 1 1 3254 0<br>
>  - attr(*, "names")= chr [1:4] "X1" "X2" "X3" "X4"<br>
><br>
><br>
> I am using R 3.1.0 and Rcpp 0.11.1. Does the message "Error during wrapup:<br>
> 'getCharCE' must be called on a CHARSXP" within this context hint anything<br>
> to anyone familiar with Rcpp's internals? I realize it's almost impossible<br>
> to diagnose with the given information -- is there a way to get Rcpp to<br>
> display more debugging information?<br>
><br>
> Thank you.<br>
><br>
</div></div>> _______________________________________________<br>
> Rcpp-devel mailing list<br>
> <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org" target="_blank">Rcpp-devel@lists.r-forge.r-project.org</a><br>
> <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Rcpp-devel mailing list</span><br><span><a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a></span><br><span><a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a></span></div></blockquote></body></html>