Displaying 11 results from an estimated 11 matches for "do_subassign2_dflt".
2024 Apr 05
1
Bug in out-of-bounds assignment of list object to expression() vector
...NULL)
> ```
>
> Curiously, this behavior disappears if a prior attempt is made at
> assigning to the same index, using a different incompatible object
> that does not share this bug (like a function)
Here's how the problem happens:
1. The call lands in src/main/subassign.c, do_subassign2_dflt().
2. do_subassign2_dflt() calls SubassignTypeFix() to prepare the operand
for the assignment.
3. Since the assignment is "stretching", SubassignTypeFix() calls
EnlargeVector() to provide the space for the assignment.
The bug relies on `x` not being IS_GROWABLE(), which may explain
wh...
2024 Apr 05
1
[External] Re: Bug in out-of-bounds assignment of list object to expression() vector
...t; Curiously, this behavior disappears if a prior attempt is made at
>> assigning to the same index, using a different incompatible object
>> that does not share this bug (like a function)
>
> Here's how the problem happens:
>
> 1. The call lands in src/main/subassign.c, do_subassign2_dflt().
>
> 2. do_subassign2_dflt() calls SubassignTypeFix() to prepare the operand
> for the assignment.
>
> 3. Since the assignment is "stretching", SubassignTypeFix() calls
> EnlargeVector() to provide the space for the assignment.
>
> The bug relies on `x` not being...
2013 Jan 09
2
Bug in list subset assignment due to NAMED optimization
...wrong. It's returning the
updated `a` rather than the RHS of the assignment. The second sequence in
both cases is correct; the assignment to `b` increments the NAMED value
causing the necessary copy to be made so the RHS is returned from the
assignment.
Would it be sufficient to add a check to do_subassign2_dflt
and do_subassign3_dflt that creates a duplicate of the LHS if the LHS & RHS
are the same object?
Justin
[[alternative HTML version deleted]]
2024 Apr 05
3
Bug in out-of-bounds assignment of list object to expression() vector
There seems to be a bug in out-of-bounds assignment of list objects to an
expression() vector. Tested on release and devel. (Many thanks to folks
over at Mastodon for the help narrowing down this bug)
When assigning a list into an existing index, it correctly errors on
incompatible type, and the expression vector is unchanged:
```
x <- expression(a,b,c)
x[[3]] <- list() # Error
x
#>
2010 Feb 19
3
Rubbish values written with zero-length vectors (PR#14217)
Full_Name: George Russell
Version: 2.10.0, 2.11.0 (2009-12-13 r50716)
OS: Windows
Submission from: (NULL) (217.111.3.131)
R trace:
-- cut here --
> v <- integer(0)
> v[[1]] <- v
> v
[1] 20522144
> v <- numeric(0)
> v[[1]] <- v
> v
[1] 4.254131e-314
> sessionInfo()
R version 2.10.0 (2009-10-26)
i386-pc-mingw32
locale:
[1] LC_COLLATE=German_Germany.1252
2020 Feb 19
2
dimnames incoherence?
...t;-`(NULL, 1, "a" ) # gives "a" (*not* a list)
`[[<-`(NULL, 1, c("a","b")) # gives list(c("a","b")) !!
##==> in C code: in subassign.c [ ~/R/D/r-devel/R/src/main/subassign.c ]
##==> function (~ 340 lines)
## do_subassign2_dflt(SEXP call, SEXP op, SEXP args, SEXP rho)
## has
"
line svn r. svn auth. c.o.d.e...
---- ------ --------- ----------------------------------------------
1741 4166 ihaka if (isNull(x)) {
1742 45446 ripley if (isNull(y)) {
1743 76166 luke UNPROTECT(2);...
2012 Feb 21
0
Help with debugging message
...infinite wait.
Kill it with cntrl\, claims to have died in Rf_alloc :
==5420==
==5420== Process terminating with default action of signal 3 (SIGQUIT)
==5420== at 0x4D14695: Rf_allocVector (memory.c:2445)
==5420== by 0x4D8FCAC: SubassignTypeFix (subassign.c:113)
==5420== by 0x4D91146: do_subassign2_dflt (subassign.c:1568)
==5420== by 0x4D92012: do_subassign2 (subassign.c:1451)
==5420== by 0x4CD940D: Rf_eval (eval.c:469)
==5420== by 0x4CDBEB6: do_set (eval.c:1724)
==5420== by 0x4CD940D: Rf_eval (eval.c:469)
==5420== by 0x4CDB91B: applydefine (eval.c:1680)
==5420== by 0x4CD940D: Rf...
2005 Sep 26
3
Assigning a zero length vector to a list (PR#8157)
Full_Name: Jussi Jousimo
Version: 2.2.0 beta
OS: Windows XP
Submission from: (NULL) (193.167.195.60)
I'm trying to assign a zero length vector to a list:
x<-numeric()
length(x)
foo<-list()
foo$bar[[1]]<-x
length(foo$bar[[1]])
foo
But in the list this vector turns out to be length one with random content.
x<-character() makes R to crash.
2020 Feb 21
0
dimnames incoherence?
...quot; ) # gives "a" (*not* a list)
> `[[<-`(NULL, 1, c("a","b")) # gives list(c("a","b")) !!
>
> ##==> in C code: in subassign.c [ ~/R/D/r-devel/R/src/main/subassign.c ]
> ##==> function (~ 340 lines)
> ## do_subassign2_dflt(SEXP call, SEXP op, SEXP args, SEXP rho)
> ## has
> "
> line svn r. svn auth. c.o.d.e...
> ---- ------ --------- ----------------------------------------------
> 1741 4166 ihaka if (isNull(x)) {
> 1742 45446 ripley if (isNull(y)) {
> 1743 76166...
2020 Feb 19
3
dimnames incoherence?
Hi,
I was bitten by a little incoherence in dimnames assignment or may be I
missed some point.
Here is the case. If I assign row names via dimnames(a)[[1]], when
nrow(a)=1 then an error is thrown. But if I do the same when nrow(a) > 1
it's OK. Is one of this case works unexpectedly? Both? Neither?
a=as.matrix(1)
dimnames(a)[[1]]="a" # error: 'dimnames' must be a list
2020 Feb 22
2
dimnames incoherence?
...* a list)
>> `[[<-`(NULL, 1, c("a","b")) # gives list(c("a","b")) !!
>>
>> ##==> in C code: in subassign.c [ ~/R/D/r-devel/R/src/main/subassign.c ]
>> ##==> function (~ 340 lines)
>> ## do_subassign2_dflt(SEXP call, SEXP op, SEXP args, SEXP rho)
>> ## has
>> "
>> line svn r. svn auth. c.o.d.e...
>> ---- ------ --------- ----------------------------------------------
>> 1741 4166 ihaka if (isNull(x)) {
>> 1742 45446 ri...