-
-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C++ exceptions are not generating proper condition objects #579
Comments
Thanks for filing this. I noticed that too in the (printed) value of |
Looks like ccb3259 was when this was introduced. The commit prior prints However I am still a little unclear when the |
FWIW, the main calls that are used to construct the stack trace are here: Rcpp/inst/include/Rcpp/exceptions.h Lines 152 to 183 in 88ebc36
With other stuff in https://github.com/RcppCore/Rcpp/blob/88ebc36c89789c035135ca9b35dcfb316d2bce94/src/barrier.cpp. I recall that we did a bunch of crazy stuff around error, warning and message handling but had to roll it back as it broke the handling of |
My memory is also fuzzy. I am also unclear whether we ever explicitly filled |
It may be this commit that broke things: 454de74 Note that prior to this we had calls to the error recorder: Rcpp/inst/include/Rcpp/api/meat/Rcpp_eval.h Lines 80 to 90 in 1c90562
We probably need to restore these error-recording calls in |
I fear this might not be behaving as expected again. Doesn't seem to be propagating the C++ error at all on my system. Am I missing something?
|
I think we may be behind one update on that very Rcpp Gallery post. We just discussed this around here. I think part of the story is that you either need to use Rcpp Attributes to get proper wrapping, or use the |
Thanks for the quick return, sorry for being slow but didn't really understand the reply. Are you saying that the gallery is out of date with how to do propagate C++ errors? Or that it isn't possible? Tried to figure out by myself, but that gallery example already uses Rcpp attributes and using the BEGIN_RCPP macro instead of the try / catch resulted in identical behaviour. Sorry for not getting it. |
Are you using the default system compiler, or the CRAN-provided LLVM toolchain? I suspect you're running into toolchain issues and not Rcpp issues. Here's what I see when using the system toolchain:
|
Thanks Kevin. I'm using clang 4.0.0 as per CRAN page rather than the default macOS compiler. Actually using a higher version of gfortran (7.2.0) than the one on the 6.1 suggested, but assume that wouldn't have impact here. Here is the output of the compile step for Rcpp (I've tried C++11 and C++14 as I am using C++11 features in my code).
|
The issue will likely go away if you use the default system toolchain (which is honestly what I'd recommend). |
That said, it looks like the original issue (no C++ stack available) is actually still present. :-/ (but at least when using the system toolchain you do get the correct exception message) |
Sorry, I missed one bit -- you only get a C++ back trace if you throw an Rcpp exception, and that case does work as expected. So I think this does come back to the CRAN LLVM toolchain not behaving as expected here. |
Thanks Kevin - just come back to it and you are exactly right. When I changed back to the system compiler, the error message propagates as expected. Thanks both for your help. |
In particular the
call
andcppstack
elements are not being populated appropriately. Looks like this condition object is created from exception_to_r_condition. The same behavior exists on MacOS (clang) and Windows. I did not test Linux.Steps to reproduce
Session Info
The text was updated successfully, but these errors were encountered: