bug-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gsl] GSL: make check fails


From: Gregery Barton
Subject: Re: [Bug-gsl] GSL: make check fails
Date: Tue, 18 Aug 2009 19:19:07 -0700 (PDT)

Check for memory corruption in the sort algorithm.  Specifically the downheap() 
functions.  There are two of them.  In sort.c and sortind.c

Through the joys  (perhaps a compiler bug) of C inline sometimes doesn't inline 
because the compiler sees it as infeasible to do so.  But when the inline is 
silently dropped, the function is put in the symbol table, when a function is 
in the symbol table it is extern.  If two functions are in the symbol table 
with the same name one will silently be dropped.

so
file1.c:
static inline void foobar()

file2.c:
static inline void foobar()

If the compiler drops the inline it's the same as

file1.c:
extern void foobar()

file2.c:
extern void foobar()

Which is just awesome

Name conflicts like this are resolved by dropping one function.  So trace 
through the code and check that the right downheap() function (they have 
slightly different prototypes) is being called.

I found this out because of weird failures in statistics and sort as well.  And 
fixed it by removing the "inline" keyword in front of the downheap functions.

Regards,
Greg.





----- Original Message ----
From: "address@hidden" <address@hidden>
To: Brian Gough <address@hidden>
Cc: address@hidden
Sent: Wednesday, 19 August, 2009 9:31:42 AM
Subject: Re: [Bug-gsl] GSL: make check fails

Brian,
        I put some print statements before the the gsl_test in the 
gsl-1.12/statistics/test_float_source.c around line 335 and the test 
passed.  If I comment out the print statement the test failedas before. Am 
I inserted the print statements in the right place?

  /* Test for IEEE handling - set third element to NaN */

  groupa [3*stridea] = GSL_NAN;

  {
    BASE max = FUNCTION(gsl_stats,max) (groupa, stridea, na);
        printf ("\nmax = " OUT_FORMAT, max);
    BASE expected = GSL_NAN;
        printf ("\nexpected = " OUT_FORMAT, expected);
        printf ("\n!insana(max) = %i\n", !isnan(max));
    gsl_test  (!isnan(max),
               NAME(gsl_stats) "_max NaN (" OUT_FORMAT " observed vs " 
OUT_FORMAT " expected)", 
               max, expected);
  }

  {
    BASE min = FUNCTION(gsl_stats,min) (groupa, stridea, na);
        printf ("\nmin = " OUT_FORMAT, min);
    BASE expected = GSL_NAN;
        printf ("\nexpected = " OUT_FORMAT, expected);
        printf ("\n!insana(min) = %i\n", !isnan(min));
    gsl_test (!isnan(min),
              NAME(gsl_stats) "_min NaN (" OUT_FORMAT " observed vs " 
OUT_FORMAT " expected)", 
              min, expected);
  }


      
__________________________________________________________________________________
Find local businesses and services in your area with Yahoo!7 Local.
Get started: http://local.yahoo.com.au




reply via email to

[Prev in Thread] Current Thread [Next in Thread]