[R-SIG-Mac] [External] Rmpfr crashes on Mac

Dev Chakraborty dpc10@ter @end|ng |rom gm@||@com
Mon Nov 29 00:56:13 CET 2021


I am using:

RStudio 2021.09.0+351 "Ghost Orchid" Release
(077589bcad3467ae79f318afe8641a1899a51606, 2021-09-20) for macOS
Mozilla/5.0 (Macintosh; Intel Mac OS X 12_0_1) AppleWebKit/537.36 (KHTML,
like Gecko) QtWebEngine/5.12.10 Chrome/69.0.3497.128 Safari/537.36

It is an RStudio issue; the problem does not occur when I run R from the
Console.

Thanks for the suggestion.

Dev

On Sun, Nov 28, 2021 at 6:39 PM Erich Subscriptions <
erich.subs using neuwirth.priv.at> wrote:

> One more thing:
> After compiling Rmpfr from source,
> things worked.
>
> > On 29.11.2021, at 00:30, Kevin Ushey <kevinushey using gmail.com> wrote:
> >
> > I can reproduce something similar on my M1 macOS machine, when using the
> > x86_64 build of R. I see:
> >
> >> x1 <- mpfr(-50, 200)
> > *** caught illegal operation ***
> > address 0x10c5f623b, cause 'illegal opcode'
> >
> > This is with the binary of Rmpfr 0.8-7 as from CRAN, with R 4.1.2. Here's
> > what LLDB says:
> >
> > * thread #1, queue = 'com.apple.main-thread', stop reason =
> > EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
> >    frame #0: 0x000000010f69c23b Rmpfr.so`mpfr_set_d + 43
> > Rmpfr.so`mpfr_set_d:
> > ->  0x10f69c23b <+43>: vucomisd %xmm0, %xmm0
> >    0x10f69c23f <+47>: jp     0x10f69c39a               ; <+394>
> >    0x10f69c245 <+53>: vpxor  %xmm1, %xmm1, %xmm1
> >    0x10f69c249 <+57>: vucomisd %xmm1, %xmm0
> >
> > And the relevant part of the stack trace:
> >
> > (lldb) bt
> > * thread #1, queue = 'com.apple.main-thread', stop reason =
> > EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
> >  * frame #0: 0x000000010f69c23b Rmpfr.so`mpfr_set_d + 43
> >    frame #1: 0x000000010f6809d3 Rmpfr.so`d2mpfr1_(x=-50,
> > i_prec=<unavailable>, rnd=MPFR_RNDN) at convert.c:129:5 [opt]
> >    frame #2: 0x000000010f680eb0 Rmpfr.so`d2mpfr1_list(x=<unavailable>,
> > prec=<unavailable>, rnd_mode=<unavailable>) at convert.c:186:29 [opt]
> >
> > At least for my case, my guess is that the 'vucomisd' instruction isn't
> > available via Apple's Rosetta emulation. It's possible users with older
> > macOS machines not supporting AVX instructions could see this, as well?
> >
> > Best,
> > Kevin
> >
> > On Sun, Nov 28, 2021 at 9:54 AM Richard M. Heiberger <rmh using temple.edu>
> wrote:
> >
> >> Works normally in R-4.1.2 with Rmpfr_0.8-7 on Macintosh
> >> aarch64-apple-darwin20
> >> I am running inside Emacs using ESS
> >>
> >>> packageVersion("Rmpfr")
> >> [1] ‘0.8.7’
> >>> library(Rmpfr)
> >> Loading required package: gmp
> >>
> >> Attaching package: ‘gmp’
> >>
> >> The following objects are masked from ‘package:base’:
> >>
> >>    %*%, apply, crossprod, matrix, tcrossprod
> >>
> >> C code of R package 'Rmpfr': GMP using 64 bits per limb
> >>
> >>
> >> Attaching package: ‘Rmpfr’
> >>
> >> The following object is masked from ‘package:gmp’:
> >>
> >>    outer
> >>
> >> The following objects are masked from ‘package:stats’:
> >>
> >>    dbinom, dgamma, dnbinom, dnorm, dpois, dt, pnorm
> >>
> >> The following objects are masked from ‘package:base’:
> >>
> >>    cbind, pmax, pmin, rbind
> >>
> >>> x1 <- mpfr(-50, 200)
> >>> x1
> >> 1 'mpfr' number of precision  200   bits
> >> [1] -50
> >>> x2 <- mpfr(-50.1, 200)
> >>> x2
> >> 1 'mpfr' number of precision  200   bits
> >> [1] -50.10000000000000142108547152020037174224853515625
> >>> version
> >>               _
> >> platform       aarch64-apple-darwin20
> >> arch           aarch64
> >> os             darwin20
> >> system         aarch64, darwin20
> >> status
> >> major          4
> >> minor          1.2
> >> year           2021
> >> month          11
> >> day            01
> >> svn rev        81115
> >> language       R
> >> version.string R version 4.1.2 (2021-11-01)
> >> nickname       Bird Hippie
> >>>
> >>
> >>> On Nov 27, 2021, at 15:46, Dev Chakraborty <dpc10ster using gmail.com>
> wrote:
> >>>
> >>> I used package Rmpfr ca. 2017 and it worked fine. The latest version
> >>> (0.8-7) causes R (running under RStudio) to crash. A simple example is:
> >>>
> >>> library(Rmpfr)
> >>> x1 <- mpfr(-50, 200)
> >>> x2 <- mpfr(-50.1, 200)
> >>>
> >>> Which gives the message:
> >>>
> >>> R Session Aborted
> >>> R encountered a fatal error
> >>> The session was terminated
> >>> Start New Session
> >>>
> >>> I am using R version 4.1.1 on a Mac running MacOS 12.0.1. and an older
> >> iMac
> >>> running 10.15.7. The problem occurs with both machines.
> >>>
> >>> When I install from the CRAN archive file  Rmpfr_0.6-1.tar.gz (the
> >> version
> >>> of the package around 2017, corresponding to the last time I used it)
> the
> >>> problem goes away.
> >>>
> >>>      [[alternative HTML version deleted]]
> >>>
> >>> _______________________________________________
> >>> R-SIG-Mac mailing list
> >>> R-SIG-Mac using r-project.org
> >>>
> >>
> https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-sig-mac&data=04%7C01%7Crmh%40temple.edu%7C3aabc743f322409d6fa308d9b259a7bb%7C716e81efb52244738e3110bd02ccf6e5%7C0%7C0%7C637736920545174898%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&sdata=pNPM8x8q1%2BQxq4QevSbfjlcO44vDVEyUvsRlfDBfgBo%3D&reserved=0
> >>
> >> _______________________________________________
> >> R-SIG-Mac mailing list
> >> R-SIG-Mac using r-project.org
> >> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
> >>
> >
> >       [[alternative HTML version deleted]]
> >
> > _______________________________________________
> > R-SIG-Mac mailing list
> > R-SIG-Mac using r-project.org
> > https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>
>

	[[alternative HTML version deleted]]



More information about the R-SIG-Mac mailing list