[R-SIG-Mac] Some exceptions not thrown properly with clang4
Brian Ripley
ripley at stats.ox.ac.uk
Thu Sep 21 09:02:25 CEST 2017
The issue is not clang 4 per se. It can be seen in the CRAN logs for quite a few packages built with the clang 4 build from r.research.att.com, all of which worked correctly with the LLVM distribution of clang 4.0.0 (and 4.0.1): the latter required macOS Sierra (without saying so). And, as you say, with at least one version of the Command Line Tools (via Xcode or directly), that for 10.12 (but that lacks OpenMP support).
> On 20 Sep 2017, at 23:53, Jonah S Gabry <jsg2201 at columbia.edu> wrote:
>
> Sorry if line breaks are missing from the test.cpp example file in my
> original post.
>
>> On Wed, Sep 20, 2017 at 2:00 PM, Jonah S Gabry <jsg2201 at columbia.edu> wrote:
>>
>> With clang4 installed and Makevars updated as described at
>> https://cran.r-project.org/bin/macosx/ we are finding unexpected behavior
>> related to exceptions. The issue was brought to our attention at
>>
>> http://discourse.mc-stan.org/t/error-in-rstan-2-16-2-after-
>> upgrading-to-r-3-4-1-with-clang-4-0-0/1893
>>
>> but here is a minimal example:
>>
>> Put the following in "test.cpp":
>>
>> #include <Rcpp.h> using namespace Rcpp; // [[Rcpp::export]] int
>> throw_exception() { std::stringstream errmsg; errmsg << "this is an
>> exception"; throw std::domain_error(errmsg.str()); return 0; }
>>
>> Then compile and test it with:
>>
>> Rcpp::sourceCpp("test.cpp")
>> throw_exception()
>>
>> The output is:
>>
>> Error in throw_exception() : c++ exception (unknown reason)
>>
>> But the expected output (and the output I get when using e.g. the clang
>> installation from Xcode) is:
>>
>> Error in throw_exception() : this is an exception
>>
>> Is this a known issue?
>>
>> Thanks,
>>
>> Jonah
>>
>> -----
>>
>> I'm running the following:
>>
>> R version 3.4.1 (2017-06-30)
>> Platform: x86_64-apple-darwin15.6.0 (64-bit)
>> Running under: macOS Sierra 10.12.6
>>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
More information about the R-SIG-Mac
mailing list