-
-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warnings fixes #1680
Warnings fixes #1680
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1865,7 +1865,7 @@ H5FD__mpio_vector_build_types(uint32_t count, H5FD_mem_t types[], haddr_t addrs[ | |
if (!sub_types) { | ||
HDassert(!sub_types_created); | ||
|
||
if (NULL == (sub_types = (int *)HDmalloc((size_t)count * sizeof(MPI_Datatype)))) | ||
if (NULL == (sub_types = HDmalloc((size_t)count * sizeof(MPI_Datatype)))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sub_types is an MPI_Datatype *, not an int * There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's no need to cast the allocated pointers in C anyways. |
||
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "can't alloc sub types array") | ||
if (NULL == (sub_types_created = (uint8_t *)HDcalloc((size_t)count, 1))) { | ||
H5MM_free(sub_types); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2694,18 +2694,18 @@ my_isnan(dtype_t type, void *val) | |
if (FLT_FLOAT == type) { | ||
float x = 0.0; | ||
HDmemcpy(&x, val, sizeof(float)); | ||
retval = (x != x); | ||
retval = !H5_FLT_ABS_EQUAL(x, x); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't compare floats, doubles, long doubles using != here. Use library macro to compare with an epsilon value instead. |
||
} | ||
else if (FLT_DOUBLE == type) { | ||
double x = 0.0; | ||
HDmemcpy(&x, val, sizeof(double)); | ||
retval = (x != x); | ||
retval = !H5_DBL_ABS_EQUAL(x, x); | ||
#if H5_SIZEOF_LONG_DOUBLE != H5_SIZEOF_DOUBLE | ||
} | ||
else if (FLT_LDOUBLE == type) { | ||
long double x = 0.0L; | ||
HDmemcpy(&x, val, sizeof(long double)); | ||
retval = (x != x); | ||
retval = !H5_LDBL_ABS_EQUAL(x, x); | ||
#endif | ||
} | ||
else { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be immediately before the HDassert(dataset) line, otherwise that assert will always be tripped.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was building in release so missed this one! Just fixed the assertion and pushed.