This is the mail archive of the
gsl-discuss@sourceware.cygnus.com
mailing list for the GSL project.
weird error in gsl_ran_discrete
- To: Mark Galassi <rosalia@cygnus.com>
- Subject: weird error in gsl_ran_discrete
- From: James Theiler <jt@nis.lanl.gov>
- Date: Sat, 20 Feb 1999 11:31:09 -0700 (MST)
- cc: GSL discussion list <gsl-discuss@sourceware.cygnus.com>
On Sat, 20 Feb 1999, James Theiler wrote:
] On Sat, 20 Feb 1999, James Theiler wrote:
]
] ] When I ran 'make check', all tests passed except for some of the ...
]
] Hi again,
] I looked over the tests and realized that 'make check' doesn't check
] either the rng or the randist directories. maybe that's on purpose.
] Anyway, when I do 'make check' in those directories, I find that
] rng: all tests PASS
] randist: all tests PASS, except two cases for gsl_ran_discrete (whoa!
] that's my code; i thought i'd checked that...)
]
] If I can find the problem, I'll check in a patch forthwith.
]
I give up.
If I ifdef-out all the tests in test.c that preceed
testMoments(FUNC(discrete), ...), or even just move those tests to
the beginning of the list, then the tests pass.
Or, if I compile discrete.c using only CFLAGS=-g, (not using -O2), and
then 'make check', everything works fine.
Seems to me that it is either some subtle memory allocation bug, or
possibly even a flaw in the compiler. (I'm using gcc --version=2.8.1)
I actually saw something like this on my Linux box when I was developing
this code; it wasn't this GSL incarnation but an earlier one; again,
it worked if CFLAGS=-g but failed with CFLAGS='-g -O2'. When I tried
it using egcs instead of gcc, then it worked fine.
Wish I had time to follow this one up...
regards,
jt
---------------------------------------------
James Theiler jt@lanl.gov
MS-D436, NIS-2, LANL tel: 505/665-5682
Los Alamos, NM 87545 fax: 505/665-4414
----- Space and Remote Sensing Sciences -----