Skip to content

Commit 92ba286

Browse files
committed
icc complains conversion from 'long long' to 'float'
when -Wimplicit-const-int-float-conversion is used. ncx.c:2824:12: warning: implicit conversion from 'long long' to 'float' changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-const-int-float-conversion] if (xx == LONGLONG_MAX) *ip = LONGLONG_MAX; ~~ ^~~~~~~~~~~~ ncx.c:64:22: note: expanded from macro 'LONGLONG_MAX' #define LONGLONG_MAX LONG_LONG_MAX ^~~~~~~~~~~~~ ncx.c:61:23: note: expanded from macro 'LONG_LONG_MAX' #define LONG_LONG_MAX LLONG_MAX ^~~~~~~~~ /opt/intel/oneapi/compiler/2023.1.0/linux/lib/clang/16/include/limits.h:103:20: note: expanded from macro 'LLONG_MAX' #define LLONG_MAX __LONG_LONG_MAX__ ^~~~~~~~~~~~~~~~~ <built-in>:52:27: note: expanded from here #define __LONG_LONG_MAX__ 9223372036854775807LL ^~~~~~~~~~~~~~~~~~~~~
1 parent 2dc59b4 commit 92ba286

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

src/drivers/common/ncx.m4

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -513,18 +513,18 @@ define(`GETF_CheckBND',
513513
')dnl
514514

515515
dnl
516-
dnl For GET APIs boudnary check for when $1 is either 'longlong' or 'ulonglong'
516+
dnl For GET APIs boudnary check for when $2 is either 'longlong' or 'ulonglong'
517517
dnl
518518
define(`GETF_CheckBND2',
519-
`ifelse(index(`$1',`u'), 0,
520-
`if (xx == Upcase($1)_MAX) *ip = Upcase($1)_MAX;',dnl for unsigned type
521-
`if (xx == Upcase($1)_MAX) *ip = Upcase($1)_MAX;
522-
else if (xx == Upcase($1)_MIN) *ip = Upcase($1)_MIN;')
523-
else if (xx > (double)Upcase($1)_MAX || xx < Dmin($1)) {
524-
ifdef(`ERANGE_FILL',`*ip = FillDefaultValue($1);')
519+
`ifelse(index(`$2',`u'), 0,
520+
`if (xx == ($1)Upcase($2)_MAX) *ip = Upcase($2)_MAX;',dnl for unsigned type
521+
`if (xx == ($1)Upcase($2)_MAX) *ip = Upcase($2)_MAX;
522+
else if (xx == Upcase($2)_MIN) *ip = Upcase($2)_MIN;')
523+
else if (xx > (double)Upcase($2)_MAX || xx < Dmin($2)) {
524+
ifdef(`ERANGE_FILL',`*ip = FillDefaultValue($2);')
525525
DEBUG_RETURN_ERROR(NC_ERANGE)
526526
}
527-
else *ip = ($1)xx;')
527+
else *ip = ($2)xx;')
528528

529529
/*
530530
* Primitive numeric conversion functions.
@@ -541,12 +541,12 @@ APIPrefix`x_get_'NC_TYPE($1)_$2(const void *xp, $2 *ip)
541541
{
542542
ix_$1 xx;
543543
get_ix_$1(xp, &xx);
544-
ifelse(`$1', `float', `ifelse(`$2', `longlong', GETF_CheckBND2($2),
545-
`$2', `ulonglong', GETF_CheckBND2($2),
544+
ifelse(`$1', `float', `ifelse(`$2', `longlong', GETF_CheckBND2($1,$2),
545+
`$2', `ulonglong', GETF_CheckBND2($1,$2),
546546
`$2', `double', `*ip = ($2)xx;',
547547
GETF_CheckBND($2))',
548-
`$1', `double', `ifelse(`$2', `longlong', GETF_CheckBND2($2),
549-
`$2', `ulonglong', GETF_CheckBND2($2),
548+
`$1', `double', `ifelse(`$2', `longlong', GETF_CheckBND2($1,$2),
549+
`$2', `ulonglong', GETF_CheckBND2($1,$2),
550550
GETF_CheckBND($2))',
551551
`*ip = ($2)xx;')
552552
return NC_NOERR;
@@ -609,7 +609,7 @@ APIPrefix`x_put_'NC_TYPE($1)_$2(void *xp, const $2 *ip, void *fillp)
609609
int err=NC_NOERR;
610610
ix_$1 xx = FillDefaultValue($1);
611611

612-
ifelse(`$2', `double', `if (*ip > Xmax($1) || *ip < DXmin($1)) {
612+
ifelse(`$2', `double', `if (*ip > (double)Xmax($1) || *ip < DXmin($1)) {
613613
FillValue($1, &xx)
614614
DEBUG_ASSIGN_ERROR(err, NC_ERANGE)
615615
} ifdef(`ERANGE_FILL',`else')',

src/utils/ncmpidump/ncmpidump.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,10 +582,10 @@ do_ncdump(const char *path, struct fspec* specp)
582582
var.fillval = NC_FILL_DOUBLE;
583583
break;
584584
case NC_INT64:
585-
var.fillval = NC_FILL_INT64;
585+
var.fillval = (double)NC_FILL_INT64;
586586
break;
587587
case NC_UINT64:
588-
var.fillval = NC_FILL_UINT64;
588+
var.fillval = (double)NC_FILL_UINT64;
589589
break;
590590
default:
591591
break;

0 commit comments

Comments
 (0)