star-sp

Random number generators and distributions
git clone git://git.meso-star.fr/star-sp.git
Log | Files | Refs | README | LICENSE

commit 77ec5d267bf9bf77a5270ea6be32cee37387c1b1
parent c48c32311e9beaa6eb01b93d678281626515c6af
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 18 Nov 2015 16:41:41 +0100

Use a workaround in the RNG kiss test with the CL19 compiler

Diffstat:
Msrc/test_ssp_rng.c | 12++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/test_ssp_rng.c b/src/test_ssp_rng.c @@ -178,14 +178,22 @@ test_rng(const struct ssp_rng_type* type) CHECK(ssp_rng_read(NULL, NULL), RES_BAD_ARG); CHECK(ssp_rng_read(rng, NULL), RES_BAD_ARG); CHECK(ssp_rng_read(NULL, stream), RES_BAD_ARG); + +#if defined(COMPILER_CL) && _MSC_VER!=1900 + /* Actually, this check works propertly with the CL compiler but will lead to + * an inexplicable error in the next check. It seems that reading from a + * stream in "w+" mode whose pointer is EOF corrupts the stream when the code + * is compiled with CL19! So, simply disable this check when this compiler is + * used */ CHECK(ssp_rng_read(rng, stream), can_rw ? RES_IO_ERR : RES_BAD_OP); +#endif rewind(stream); CHECK(ssp_rng_read(rng, stream), can_rw ? RES_OK : RES_BAD_OP); if (can_rw) { FOR_EACH(i, 0, NRAND) { - uint64_t r = ssp_rng_get(rng); - CHECK(r, datai0[i]); + uint64_t rn = ssp_rng_get(rng); + CHECK(rn, datai0[i]); } } fclose(stream);