From tomas.kalibera at gmail.com  Mon Oct 23 12:52:50 2017
From: tomas.kalibera at gmail.com (Tomas Kalibera)
Date: Mon, 23 Oct 2017 12:52:50 +0200
Subject: [Rd] Illegal Logical Values
In-Reply-To: <20171021141427.GA6941@mail.cs.toronto.edu>
References: <mailman.9.1508580002.48586.r-devel@r-project.org>
 <20171021141427.GA6941@mail.cs.toronto.edu>
Message-ID: <7de2b1c6-c529-b6a2-3ae7-acbccec91aa9@gmail.com>

On 10/21/2017 04:14 PM, Radford Neal wrote:
>> On Fri, 2017-10-20 at 14:01 +0000, brodie gaslam via R-devel wrote:
>>> I'm thinking of this passage:
>>>
>>>> Logical values are sent as 0 (FALSE), 1 (TRUE) or INT_MIN =
>>>> -2147483648 (NA, but only if NAOK is true), and the compiled code
>>>> should return one of these three values. (Non-zero values other
>>>> than INT_MIN are mapped to TRUE.)
>>> The parenthetical seems to suggest that something like 'LOGICAL(x)[0]
>>> = 2;' will be treated as TRUE, which it sometimes is, and sometimes
>>> isn't:
>> From: Martyn Plummer <plummerm at iarc.fr>
>> The title of Section 5.2 is "Interface functions .C and .Fortran" and
>> the text above refers to those interfaces. It explains how logical
>> vectors are mapped to C integer arrays on entry and back again on exit.
>>
>> This does work as advertised.
>
> Not always.  As I reported on bugzilla three years ago (PR#15878), it
> only works if the logical argument does not have to be copied.  The
> bug has been fixed in pqR since pqR-2014-09-30.
>
>     Radford Neal
Thanks, that's indeed a bug - now fixed in 73583.
Tomas

>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] Illegal Logical Values
Tomas Kalibera