Commit b6d4dde3 authored by Rob Latham's avatar Rob Latham Committed by Antonio J. Pena
Browse files

make MPIU_Assert more robust



instead of assigning and then checking for overflow, check if the
overflow will happen, and then assign.
Signed-off-by: default avatarAntonio J. Pena <apenya@mcs.anl.gov>
parent b2ec3e57
......@@ -239,9 +239,9 @@ int MPIR_Assert_fail_fmt(const char *cond, const char *file_name, int line_num,
#endif
#define MPIU_Assign_trunc(dst_,src_,dst_type_) \
do { \
dst_ = (dst_type_)(src_); \
/* will catch some of the cases if the expr_inttype macros aren't available */ \
MPIU_Assert((dst_) == (src_)); \
MPIU_Assert((src_) == (dst_type_)(src_)); \
dst_ = (dst_type_)(src_); \
} while (0)
/*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment