EGCS optimizer bug?

Peter Dalgaard BSA
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

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;


[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
~~~~~~~~~~ - (             FAX: (+45) 35327907
r-devel mailing list -- Read
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: