Skip to content

Commit 91044b9

Browse files
committed
fread(): avoid casting int* to Rboolean*
This used to work because the compilers were very likely to use int as the underlying type of the enum. R-devel r87656 changes the definition of Rboolean from an enum to bool, sothe sizes and the semantics of the types are very different now. Since LOGICAL() returns int*, and NA_INTEGER is an int, keep using that to access the vector contents.
1 parent 874e571 commit 91044b9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/freadR.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ void pushBuffer(ThreadLocalFreadParsingContext *ctx)
644644
} else
645645
if (thisSize == 1) {
646646
if (type[j] > CT_BOOL8_Y) STOP(_("Field size is 1 but the field is of type %d\n"), type[j]);
647-
Rboolean *dest = (Rboolean *)LOGICAL(VECTOR_ELT(DT, resj)) + DTi;
647+
int *dest = LOGICAL(VECTOR_ELT(DT, resj)) + DTi;
648648
const char *src1 = (char*)buff1 + off1;
649649
for (int i=0; i<nRows; ++i) {
650650
int8_t v = *(int8_t *)src1;

0 commit comments

Comments
 (0)