EGCS optimizer bug?

Peter Dalgaard BSA p.dalgaard@biostat.ku.dk
25 Oct 1998 23:21:26 +0100


The current development version dies in qbeta() when compiled with
egcs -O, egcs 1.0.2 and glibc 2.0.7 (RedHat versions). Since this also
kill the F and t distributions, it doesn't exactly do wonders for R's
usefulness...

Anyone else seeing this or has my setup just gone out of whack? It
does look pretty much like a clear compiler bug when inlining math
functions (storing temporaries offset from %ebx, but no setting of
%ebx register to anything useful...)

The following paraphrase on R's qbeta.c appears to be a close to
minimal example of the problem (no, it doesn't do anything useful, and
there are several obvious things wrong with it, but it displays the
%ebx problem, if you look at the generated code):

#include <math.h>

double lbeta(){}

double qbeta(double alpha, double p, double q)
{
        double t,r, logbeta;
        volatile double xinbta;

        logbeta = lbeta(p, q);

        if (p<1) 
                t = r * pow(t, 3.);
        return xinbta;
}

main(){qbeta(.5,.5,.5);}


[pd@butterfly sandbox]$ egcs -O qbeta.c -lm
[pd@butterfly sandbox]$ ./a.out
Segmentation fault (core dumped)
[pd@butterfly sandbox]$ egcs qbeta.c -lm
[pd@butterfly sandbox]$ ./a.out


-- 
   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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._