Date: Mon, 13 Sep 1999 10:57:23 +0200 (MET DST)
From: Albrecht Gebhardt <albrecht.gebhardt@uni-klu.ac.at>
On Mon, 13 Sep 1999, Prof Brian D Ripley wrote:
[...]
I'm puzzled. Are you saying -Inf passes R_FINITE and passes ISNAN? (Wow!,
if so.) In any case, let us try and fix the macros (which crop up in many
places) not two instances.
NaN passed R_FINITE (see above). Then it gets multiplied by some values
and serves as tickmark length.
There are too many options in Arith.h to guess: can you please tell us
what path is being taken (HAVE_FINITE, IEEE_754, FINITE_BROKEN, ...).
I believe this can all be tested from interpreted R code. I believe you
should get (is.na(c(2.0, Inf, -Inf, NaN, NA)) etc)
2.0 Inf -Inf NaN NA
is.na F F F T T
is.finite T F F F F
is.infinite F T T F F
is.nan F F F T F
is.na(c(2.0, Inf, -Inf, NaN, NA))
[1] FALSE FALSE FALSE TRUE TRUE
is.finite(c(2.0, Inf, -Inf, NaN, NA))
[1] TRUE TRUE TRUE TRUE TRUE
is.infinite(c(2.0, Inf, -Inf, NaN, NA))
[1] FALSE FALSE FALSE FALSE FALSE
is.nan(c(2.0, Inf, -Inf, NaN, NA))
[1] FALSE FALSE FALSE TRUE FALSE
Seems that everything is R_FINITE!
[...]
OK, so I think you are at the line
# define R_FINITE(x) ((x) != R_NaReal)
in Arith.h, and that is clearly inadequate (although it should have
caught the NA, I think). Can you please try replacing that line by
static int R_FINITE(double x) {
return !isnan(x) & (x != R_PosInf) & (x != R_NegInf);
}
and try those tests again.
(Kurt: looks like finite can be broken in more ways than one. I suggest
return(finite(1./0.) & finite(0./0.) & finite(-1./0.)) in aclocal.m4,
and if FINITE_BROKEN going directly to some function like the above, and not
trying to be efficient, just right!)
Brian D. Ripley, ripley@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 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Date: Mon, 13 Sep 1999 10:57:23 +0200 (MET DST)
From: Albrecht Gebhardt <albrecht.gebhardt@uni-klu.ac.at>
On Mon, 13 Sep 1999, Prof Brian D Ripley wrote:
[...]
....
[...]
OK, so I think you are at the line
# define R_FINITE(x) ((x) != R_NaReal)
in Arith.h, and that is clearly inadequate (although it should have
caught the NA, I think). Can you please try replacing that line by
static int R_FINITE(double x) {
return !isnan(x) & (x != R_PosInf) & (x != R_NegInf);
}
and try those tests again.
ok, this works. Now I get even further with "make test". This stopped
somewhere with a "GPretty[Inf, ...]" error, which was obvoiusly also
caused be R_FINITE.
The patch is now:
--- ./src/include/Arith.h.finite-patch Tue Sep 14 16:31:16 1999
+++ ./src/include/Arith.h Tue Sep 14 16:32:12 1999
@@ -81,7 +81,13 @@
return FINITE(x); /* NOTE: macro does not work. */
}
# else
-# define R_FINITE(x) ((x) != R_NaReal)
+# ifdef __osf__
+ static int R_FINITE(double x) {
+ return !isnan(x) & (x != R_PosInf) & (x != R_NegInf);
+ }
+# else
+# define R_FINITE(x) ((x) != R_NaReal)
+# endif
# endif
# endif
Albrecht
PS:
"make test" still fails, the last lines of tests/Examples/base-Ex.Rout
are
#### snip ################
y
x A B C D E F
FALSE 1 1 12 11 12 0
TRUE 11 11 0 1 0 12
# Counts expected under the null
## Effect of simulating p-values
x <- matrix(c(12, 5, 7, 7), nc = 2)
chisq.test(x)$p.value # 0.4233
[1] 0.4233054
###################### snip
I can't see an error here. Or could the error be hidden somewhere before
this point? base-Ex.Rout is quite large, 4154 lines.
.... stop, now I got it, its a memory problem:
Running all help() examples ...
../../bin/R --vanilla < base-Ex.R > base-Ex.Rout
/bin/sh: 303 Memory fault
make[3]: *** [base-Ex.Rout] Error 139
make[3]: Leaving directory
`/usr/local/src/redhat/BUILD/R-0.65.0/tests/Examples'
make[2]: *** [test-Examples] Error 2
make[2]: Leaving directory `/usr/local/src/redhat/BUILD/R-0.65.0/tests'
make[1]: *** [test-All] Error 2
make[1]: Leaving directory `/usr/local/src/redhat/BUILD/R-0.65.0/tests'
make: *** [test-All] Error 2
I have to go to another machine, my alpha at home as only 256MB, and swap
space is also very small.
Or should I run the tests with memory specifications from command line?
Wouldn't it be a good idea to have "make test" running each example in a
several R process? I think I could avoid this memory fault this way. I
guess the reasons for the memory fault is a bad kernel configuration
(wrong ulimit values) and/or wrong swap space configuration and not within
R.
But on the other hand the error is reproduceable with R stopping at
exactly the same line.
-------------------------------------------------------------------------------
Albrecht Gebhardt email : albrecht.gebhardt@uni-klu.ac.at
Institut fuer Mathematik Tel. : (++43 463) 2700/837
Universitaet Klagenfurt Fax : (++43 463) 2700/834
Villacher Str. 161
A-9020 Klagenfurt, Austria
-------------------------------------------------------------------------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Albrecht Gebhardt <albrecht.gebhardt@uni-klu.ac.at> writes:
this point? base-Ex.Rout is quite large, 4154 lines.
.... stop, now I got it, its a memory problem:
Running all help() examples ...
../../bin/R --vanilla < base-Ex.R > base-Ex.Rout
/bin/sh: 303 Memory fault
make[3]: *** [base-Ex.Rout] Error 139
make[3]: Leaving directory
`/usr/local/src/redhat/BUILD/R-0.65.0/tests/Examples'
make[2]: *** [test-Examples] Error 2
make[2]: Leaving directory `/usr/local/src/redhat/BUILD/R-0.65.0/tests'
make[1]: *** [test-All] Error 2
make[1]: Leaving directory `/usr/local/src/redhat/BUILD/R-0.65.0/tests'
make: *** [test-All] Error 2
I have to go to another machine, my alpha at home as only 256MB, and swap
space is also very small.
Or should I run the tests with memory specifications from command line?
Shouldn't be necessary with the current defaults 256MB should be
plenty.
Sometimes output buffers don't flush, so what is the last line of
../../bin/R --vanilla < base-Ex.R
Wouldn't it be a good idea to have "make test" running each example in a
several R process? I think I could avoid this memory fault this way. I
guess the reasons for the memory fault is a bad kernel configuration
(wrong ulimit values) and/or wrong swap space configuration and not within
R.
But would it complete in finite time? There are a *lot* of examples,
you know....
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Albrecht Gebhardt <albrecht.gebhardt@uni-klu.ac.at> writes:
this point? base-Ex.Rout is quite large, 4154 lines.
.... stop, now I got it, its a memory problem:
Running all help() examples ...
../../bin/R --vanilla < base-Ex.R > base-Ex.Rout
/bin/sh: 303 Memory fault
make[3]: *** [base-Ex.Rout] Error 139
make[3]: Leaving directory
`/usr/local/src/redhat/BUILD/R-0.65.0/tests/Examples'
make[2]: *** [test-Examples] Error 2
make[2]: Leaving directory `/usr/local/src/redhat/BUILD/R-0.65.0/tests'
make[1]: *** [test-All] Error 2
make[1]: Leaving directory `/usr/local/src/redhat/BUILD/R-0.65.0/tests'
make: *** [test-All] Error 2
I have to go to another machine, my alpha at home as only 256MB, and swap
space is also very small.
Or should I run the tests with memory specifications from command line?
Shouldn't be necessary with the current defaults 256MB should be
plenty.
Sometimes output buffers don't flush, so what is the last line of
../../bin/R --vanilla < base-Ex.R
You were right, I found a next bug for R on alpha:
chisqsim (called from chisq.test() crashes. First I found that the crash
is at
chisqsim.c:167
167 fact[i] = x;
but after placing a breakpoint here I could go some lines further and
reach
chisqsim.c:72
72 x = exp(fact[iap - 1] + fact[ib] + fact[ic] +
The following is a log of my gdb-session:
root@delta[Examples]# ../../bin/R --vanilla < base-Ex.R
...
chisq.test(x, simulate.p.value = TRUE, B = 10000)$p.value
Segmentation fault (core dumped)
root@delta[Examples]# gdb -c core ../../bin/R.X11 -d ../../src/nmath/ -d ../../src/main/ -d ../../src/appl/
GNU gdb 4.17
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "alphaev56-dec-osf4.0d"...
Core was generated by `R.X11'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/shlib/libSM.so...done.
Reading symbols from /usr/shlib/libICE.so...done.
Reading symbols from /usr/shlib/libX11.so...done.
Reading symbols from /usr/shlib/libdnet_stub.so...done.
Reading symbols from /usr/shlib/libUfor.so...done.
Reading symbols from /usr/shlib/libfor.so...done.
Reading symbols from /usr/shlib/libFutil.so...done.
Reading symbols from /usr/shlib/libm.so...done.
Reading symbols from /usr/shlib/libots.so...done.
Reading symbols from /usr/local/lib/libreadline.so.3...done.
Reading symbols from /usr/local/lib/libncurses.so.4...done.
Reading symbols from /usr/shlib/libc.so...done.
Reading symbols from /usr/local/src/redhat/BUILD/R-0.65.0/library/eda/libs/eda.s
o...done.
---Type <return> to continue, or q <return> to quit---
#0 0x12010a280 in chisqsim (nrow=0x140ff92d0, ncol=0x140ff92c8,
nrowt=0x140ff92c0, ncolt=0x140ff92b8, n=0x140ff92b0, b=0x140ff92a8,
expected=0x140ff9288, observed=0x140ff9278, fact=0x140ff9178,
jwork=0x140ff9170, results=0x140fe58f0) at chisqsim.c:167
167 fact[i] = x;
(gdb) set env R_HOME /usr/local/src/redhat/BUILD/R-0.65.0
(gdb) break chisqsim.c:167
(gdb) run
Starting program: /usr/local/src/redhat/BUILD/R-0.65.0/tests/Examples/../../bin/R.X11
R : Copyright 1999, The R Development Core Team
Version 0.65.0 (August 27, 1999)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type "?license" or "?licence" for distribution details.
R is a collaborative project with many contributors.
Type "?contributors" for a list.
Type "demo()" for some demos, "help()" for on-line help, or
"help.start()" for a HTML browser interface to help.
Type "q()" to quit R.
x <- matrix(c(12, 5, 7, 7), nc = 2)
chisq.test(x)$p.valu
[1] 0.4233054
chisq.test(x, simulate.p.value = TRUE, B = 10000)$p.value
Breakpoint 1, chisqsim (nrow=0x140ff9ed8, ncol=0x140ff9ed0, nrowt=0x140ff9ec8,
ncolt=0x140ff9ec0, n=0x140ff9eb8, b=0x140ff9eb0, expected=0x140ff9e90,
observed=0x140ff9e80, fact=0x140ff9d80, jwork=0x140ff9d78,
results=0x140fe64f8) at chisqsim.c:167
167 fact[i] = x;
(gdb) print x
$1 = 0
(gdb) print fact
$2 = (double *) 0x140ff9d80
(gdb) print *fact
$3 = 0
(gdb) step
165 for (i = 1; i <= *n; ++i) {
(gdb)
168 }
.....
(gdb) cont
Continuing.
Program received signal SIGSEGV, Segmentation fault.
0x120109e24 in rcont2 (nrow=0x140ff9ed8, ncol=0x140ff9ed0, nrowt=0x140ff9ec0,
ncolt=0x140ff9eb8, ntotal=0x140ff9eb8, fact=0x140ff9d80,
jwork=0x140ff9d70, matrix=0x140ff9e68) at chisqsim.c:72
72 x = exp(fact[iap - 1] + fact[ib] + fact[ic] +
(gdb) print x
$7 = 0
(gdb) print iap
$8 = 51539607572
(gdb) print ib
$9 = -51539607540
(gdb) print ic
$10 = -60129542130
(gdb) list
67 idp = id + 1;
68 igp = idp - nlm;
69 ihp = iap - nlm;
70 nlmp = nlm + 1;
71 iip = ii + nlmp;
72 x = exp(fact[iap - 1] + fact[ib] + fact[ic] +
73 fact[idp - 1] - fact[ie] - fact[nlmp - 1] -
74 fact[igp - 1] - fact[ihp - 1] - fact[iip - 1]);
75 if (x >= dummy) {
76 goto L160;
(gdb) print nlmp
$11 = 65117246112
(gdb) print iip
$12 = -46551903589
(gdb) print igp
$13 = -4987703949
(gdb) print ihp
$14 = -13577638539
(gdb) print id
$15 = 60129542161
(gdb) print nlm
$16 = 65117246111
(gdb) q
The program is running. Exit anyway? (y or n) y
Albrecht
......................................................................
| Albrecht Gebhardt Tel.: (++43 463) 2700/837 |
| Institut fuer Mathematik Fax : (++43 463) 2700/834 |
| Universitaet Klagenfurt mailto:albrecht.gebhardt@uni-klu.ac.at |
| Villacher Str. 161 http://www-stat.uni-klu.ac.at/~agebhard |
| A-9020 Klagenfurt, Austria |
`--------------------------------------------------------------------'
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._