Re: [Rd] Bug in list subset assignment due to NAMED optimization

2013-01-09 Thread luke-tierney

On Tue, 8 Jan 2013, Justin Talbot wrote:


In R version 2.15.2 (2012-10-26) i386-apple-darwin9.8.0/i386 (32-bit) I get
the following:


a <- list(1)
(a[[1]] <- a)

[[1]]
[[1]][[1]]
[1] 1

but


a <- list(1)
b <- a
(a[[1]] <- a)

[[1]]
[1] 1

And similarly:


a <- list(x=1)
(a$x <- a)

$x
$x$x
[1] 1

but


a <- list(x=1)
b <- a
(a$x <- a)

$x
[1] 1

In both cases the result of the first sequence is 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?


Thanks -- that's probably the best fix but I want to think it thorugh
a bit more before committing.

Best,

luke



Justin

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel



--
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa  Phone: 319-335-3386
Department of Statistics andFax:   319-335-3017
   Actuarial Science
241 Schaeffer Hall  email:   luke-tier...@uiowa.edu
Iowa City, IA 52242 WWW:  http://www.stat.uiowa.edu

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Cannot override default -O3 flag on Winodws, dll does not have symbols

2013-01-09 Thread rtaylor
In trying to compile a package with c code using Rtools, -O3 is added by
default. This comes from Makeconf?  Compiler flags (CFLAGS="-O0 -g" ) set in
src/Makevars.win or src/Makevars appear before this.  

nm pkg.dll reveals no symbols!

How can I compile a Windows package with "-O2 -g"?

Thanks,
RT



--
View this message in context: 
http://r.789695.n4.nabble.com/Cannot-override-default-O3-flag-on-Winodws-dll-does-not-have-symbols-tp4655106.html
Sent from the R devel mailing list archive at Nabble.com.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Cannot override default -O3 flag on Winodws, dll does not have symbols

2013-01-09 Thread Dirk Eddelbuettel

On 9 January 2013 at 18:58, rtaylor wrote:
| In trying to compile a package with c code using Rtools, -O3 is added by
| default. This comes from Makeconf?  Compiler flags (CFLAGS="-O0 -g" ) set in
| src/Makevars.win or src/Makevars appear before this.  
| 
| nm pkg.dll reveals no symbols!
| 
| How can I compile a Windows package with "-O2 -g"?

a)  [long way] By locally building R with such a configure flag

b)  [shortcut] By editing the Makeconf file of the R installation used for
compiling, eg in $R_HOME/etc/Makeconf (or maybe Makeconf.win)

Dirk

-- 
Dirk Eddelbuettel | e...@debian.org | http://dirk.eddelbuettel.com

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Cannot override default -O3 flag on Winodws, dll does not have symbols

2013-01-09 Thread Prof Brian Ripley

On 10/01/2013 02:58, rtaylor wrote:

In trying to compile a package with c code using Rtools, -O3 is added by
default. This comes from Makeconf?  Compiler flags (CFLAGS="-O0 -g" ) set in
src/Makevars.win or src/Makevars appear before this.

nm pkg.dll reveals no symbols!


That is not a function of using -O3, if there is useful code (as there 
needs to be in an R package since you need to link to entry points).


How can I compile a Windows package with "-O2 -g"?


By following the manuals.  'Writing R Extensions' points you to your 
local version of

http://cran.r-project.org/doc/manuals/r-release/R-admin.html#Customizing-package-compilation

But it you want debug symbols, read about how to build a debug version 
of R in that manual (and use -gdwarf-2).





Thanks,
RT



--
View this message in context: 
http://r.789695.n4.nabble.com/Cannot-override-default-O3-flag-on-Winodws-dll-does-not-have-symbols-tp4655106.html
Sent from the R devel mailing list archive at Nabble.com.

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel




--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel