------- Comment #9 from p dot vanhoof at oma dot be  2010-02-27 13:53 -------
The following Lagrange interpolation routine crashes the trunk

> gcc -O1 -floop-parallelize-all -c bug.c
bug.c: In function ‘lagrange’:
bug.c:1:8: internal compiler error: Segmentation fault
... etc.

> gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/home/common/compilers/gcc450/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.5.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-mainline/configure --prefix=/usr/local/gcc450
--enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.5.0 20100226 (experimental) (GCC)

This is r157083 of the trunk.

> cat bug.c
double lagrange(const double x[],
                const double y[],
                long n,
                double xval)
{
        long i, j;
        double yval = 0.;

        for( i=0; i < n; i++ )
        {
                double l = 1.;
                for( j=0; j < n; j++ )
                        if( i != j )
                                l *= (xval-x[j])/(x[i]-x[j]);
                yval += y[i]*l;
        }
        return yval;
}

The same problem?


-- 

p dot vanhoof at oma dot be changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |p dot vanhoof at oma dot be


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42326

Reply via email to