From 79a3ae8b6a2a773ec0260ce1554e6ecbaa21c948 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Sat, 24 Apr 2010 19:51:54 -0500 Subject: [svn-r18627] Description: More progress toward addressing Bz#1398: add 'volatile' keyword to floating- point types when detecting their properties. Also, minor code formatting cleanups. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.6.3 (amazon) in debug mode Mac OS X/32 10.6.3 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode --- src/H5detect.c | 24 ++++++++---------------- test/dt_arith.c | 11 ++++++----- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/src/H5detect.c b/src/H5detect.c index 50b36fd..ac1185f 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -92,7 +92,7 @@ static volatile int nd_g = 0, na_g = 0; static void print_results(int nd, detected_t *d, int na, malign_t *m); static void iprint(detected_t *); -static int byte_cmp(int, void *, void *); +static int byte_cmp(int, const void *, const void *); static int bit_cmp(int, int *, void *, void *); static void fix_order(int, int, int, int *, const char **); static int imp_bit(int, int *, void *, void *); @@ -250,19 +250,10 @@ precision (detected_t *d) * matzke@llnl.gov * Jun 12 1996 * - * Modifications: - * - * Robb Matzke, 14 Aug 1996 - * The byte order detection has been changed because on the Cray - * the last pass causes a rounding to occur that causes the least - * significant mantissa byte to change unexpectedly. - * - * Robb Matzke, 5 Nov 1996 - * Removed HFILE and CFILE arguments. *------------------------------------------------------------------------- */ #define DETECT_F(TYPE,VAR,INFO) { \ - TYPE _v1, _v2, _v3; \ + volatile TYPE _v1, _v2, _v3; \ int _i, _j, _first=(-1), _last=(-1); \ char *_mesg; \ \ @@ -279,7 +270,8 @@ precision (detected_t *d) /* Byte Order */ \ for (_i=0,_v1=0.0,_v2=1.0; _i<(signed)sizeof(TYPE); _i++) { \ _v3 = _v1; _v1 += _v2; _v2 /= 256.0; \ - if ((_j=byte_cmp(sizeof(TYPE), &_v3, &_v1))>=0) { \ + _j=byte_cmp(sizeof(TYPE), &_v3, &_v1); \ + if(_j>=0) { \ if (0==_i || INFO.perm[_i-1]!=_j) { \ INFO.perm[_i] = _j; \ _last = _i; \ @@ -831,11 +823,11 @@ iprint(detected_t *d) *------------------------------------------------------------------------- */ static int -byte_cmp(int n, void *_a, void *_b) +byte_cmp(int n, const void *_a, const void *_b) { - register int i; - unsigned char *a = (unsigned char *) _a; - unsigned char *b = (unsigned char *) _b; + int i; + const unsigned char *a = (const unsigned char *) _a; + const unsigned char *b = (const unsigned char *) _b; for (i = 0; i < n; i++) if (a[i] != b[i]) return i; return -1; diff --git a/test/dt_arith.c b/test/dt_arith.c index ff6b4e0..78a05be 100644 --- a/test/dt_arith.c +++ b/test/dt_arith.c @@ -2821,6 +2821,10 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) return 0; /*child exit after catching SIGFPE*/ } else if (WIFEXITED(status)) { return WEXITSTATUS(status); + } else if (WIFSIGNALED(status)) { + sprintf(str, " Child caught signal %d.", WTERMSIG(status)); + HDputs(str); + return 1; /*child exit after catching non-SIGFPE signal */ } else { HDputs(" Child didn't exit normally."); return 1; @@ -3367,10 +3371,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) if(!fails_all_tests) PASSED(); - done: -#ifdef AKCDEBUG - printf("uflow=%d, fails_all_tests=%d\n", uflow, fails_all_tests); -#endif +done: if (buf) aligned_free(buf); if (saved) aligned_free(saved); if (aligned) HDfree(aligned); @@ -3391,7 +3392,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst) return 0; #endif - error: +error: if (buf) aligned_free(buf); if (saved) aligned_free(saved); if (aligned) HDfree(aligned); -- cgit v0.12