IBM AIX problems

Martin Maechler Martin Maechler <maechler@stat.math.ethz.ch>
Mon, 8 Jun 1998 10:52:53 +0200


Heiner Schwarte has helped me with the AIX problem that I 
and Janusz Kawczak recently reported here.

Heiner had found out earlier that there was a problem with the 
'finite' c-library function [Heiner's test code see below] when gcc 
(and older versions of xlc) is used.
He also found that instead, AIX defines a  FINITE(.) macro itself
in fp.h  and that this would work in any case.

Interestingly,  xlc (the "standard IBM AIX compiler")  has no problem 
with both  finite(.) and FINITE(.).

BUT:  I have never been successful compiling R with xlc:
      Compilation of the current snapshot stops with 

       $ xlc -DANSI -D_XOPEN_SOURCE -I/usr/local/vni/.include -I../include \
	    -c system.c
       "system.c", line 150.16: 1506-275 (S) Unexpected text readMask ignored.
       "system.c", line 150.9: 1506-045 (S) Undeclared identifier fd_set.
       "system.c", line 151.9: 1506-275 (S) Unexpected text 'int' ignored.
       "system.c", line 151.13: 1506-045 (S) Undeclared identifier stdinfd.
       "system.c", line 152.9: 1506-275 (S) Unexpected text 'int' ignored.
       "system.c", line 152.13: 1506-045 (S) Undeclared identifier connectionfd.
       "system.c", line 154.18: 1506-045 (S) Undeclared identifier readMask.
       $ xlc -DANSI -D_XOPEN_SOURCE  -I../include -c system.c
       "system.c", line 150.16: 1506-275 (S) Unexpected text readMask ignored.
       "system.c", line 150.9: 1506-045 (S) Undeclared identifier fd_set.
       "system.c", line 151.9: 1506-275 (S) Unexpected text 'int' ignored.
       "system.c", line 151.13: 1506-045 (S) Undeclared identifier stdinfd.
       "system.c", line 152.9: 1506-275 (S) Unexpected text 'int' ignored.
       "system.c", line 152.13: 1506-045 (S) Undeclared identifier connectionfd.
       "system.c", line 154.18: 1506-045 (S) Undeclared identifier readMask.
       $ 

There are several possible solutions to this problem.
One of them might be: 

1.
 >>>>	In all C code of R, use FINITE(.) only 
 >>>>	AND make sure that R is *not* redefining the  FINITE(.) macro
	in the case of AIX (or maybe whenever FINITE(.) is already defined).

or 

2.
 >>>>   In all C code of R, use  finite(.), never FINITE.
 >>>>   For the case of AIX, make finite(.) a macro calling FINITE(.)
	(this was Heiner's solution).

This might be relatively easy.
However, both Heiner and I don't know if the intermixing of
FINITE(.) and finite(.) in the R source is just ``accidental'' or
rather on purpose.
	Anyone knows?
	Are there ANSI/POSIX/...? standards for FINITE(.) ?


Note:  Maybe really configure should figure out if  finite(.) works
	and then take appropriate measures...


----------------------- Here is a Transcript from AIX : ----------------

$ date
Mon Jun  8 10:35:02 MEST 1998
$ uname -a
AIX percol 2 4 000004894600
$ cat finite-tst.c
/* Date: Sun, 07 Jun 1998 19:00:04 +0200
 * From: Heiner Schwarte <h.schwarte@bluewin.ch>
 * To: Martin Maechler <maechler@stat.math.ethz.ch>
 */

#include <stdio.h>
#include <math.h>
#include <fp.h>

main() {
  double x;
  x=1./0.;
  printf("%f\n",x);
  printf("%d\n",finite(x));
  printf("%d\n",FINITE(x));
}

$ gcc -v
Reading specs from /usr/local/lib/gcc-lib/powerpc-ibm-aix4.2.0.0/2.7.2.3/specs
gcc version 2.7.2.3
$ gcc -o finite-tst finite-tst.c
$ xlc -o finite-tst-xlc finite-tst.c
"finite-tst.c", line 22.8: 1506-232 (W) Divisor for modulus or division operator cannot be zero.
$ 
$ finite-tst # gcc
INF
1
0
$ finite-tst-xlc
INF
0
0
----------------------- End of Transcript from AIX : ----------------
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._