[Rd] switch() called with just the EXPR argument causes R to hang (PR#14124)

maechler at stat.math.ethz.ch maechler at stat.math.ethz.ch
Thu Dec 10 12:20:24 CET 2009


>>>>> "SG" == Simone Giannerini <sgiannerini at gmail.com>
>>>>>     on Thu, 10 Dec 2009 09:30:10 +0100 (CET) writes:

    SG> Dear all, switch() called with just the EXPR argument
    SG> causes R to hang so that the only way to stop it is to
    SG> kill R.

    SG> Reproducible example:

    >> switch(EXPR="a")

    SG> the internal C subroutine behind switch is do_switch
    SG> located in R/src/main/builtin.c For convenience I
    SG> reproduce it below.

    [..........]

    SG> I do not know C but it seems to me that do_switch
    SG> expects two arguments.

One can argue that it should return  NULL  when it has no
further arguments.

A fix is very simple and I'll commit it (after testing)
for R-devel and "R 2.10.1 RC".

Martin Maechler, ETH ZUrich

    SG> regards
    SG> Simone

    SG> tested both on Windows VISTA 32 bit

    SG> platform i386-pc-mingw32 arch i386 os mingw32 system
    SG> i386, mingw32 status major 2 minor 10.0 year 2009 month
    SG> 10 day 26 svn rev 50208 language R version.string R
    SG> version 2.10.0 (2009-10-26)

    SG> and on Linux OpenSuSE 11.0 64bit

    >> R.version
    SG>                _ platform x86_64-unknown-linux-gnu arch
    SG> x86_64 os linux-gnu system x86_64, linux-gnu status
    SG> Patched major 2 minor 10.0 year 2009 month 11 day 19 svn
    SG> rev 50499 language R version.string R version 2.10.0
    SG> Patched (2009-11-19 r50499)


    SG> --
    SG> ______________________________________________________

    SG> Simone Giannerini Dipartimento di Scienze Statistiche
    SG> "Paolo Fortunati" Universita' di Bologna Via delle belle
    SG> arti 41 - 40126 Bologna, ITALY Tel: +39 051 2098262 Fax:
    SG> +39 051 232153 http://www2.stat.unibo.it/giannerini/
    SG> ______________________________________________________

    SG> 	[[alternative HTML version deleted]]

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



More information about the R-devel mailing list