Skip to content
Back to formatted view

Raw Message

Message-ID: <20130713145929.GA4321@cs.toronto.edu>
Date: 2013-07-13T14:59:29Z
From: Radford Neal
Subject: missing PROTECT() in src/main/arithmetic.c
In-Reply-To: <mailman.27.1373709607.15244.r-devel@r-project.org>

> From: Herv? Pag?s <hpages at fhcrc.org>

> at lines 651 & 653 (integer_binary function):
> 
>      if (code == DIVOP || code == POWOP)
>          ans = allocVector(REALSXP, n);
>      else
>          ans = allocVector(INTSXP, n);
> 
> There are calls to warningcall() later in the function, which can
> trigger garbbage collection.
> 
> Looks like the typical scenario where it seemed pretty safe to not
> PROTECT in the original version of the function but became very
> unsafe 3 years later when the calls to warningcall() were added to
> the function.

Note that there is also a problem with a possible warning from myfmod,
which in turn is called from R_pow.  

The call of myfmod from R_pow should probably be replaced by something
else, since as it is, the following undesirable behaviour occurs:

    > (-Inf)^(1e16)
    [1] Inf
    Warning message:
    probable complete loss of accuracy in modulus 

I think issuing a warning for this is probably not a good idea, but if
a warning is issued, it certainly shouldn't be this one.

   Radford Neal