HomeFreeBSD

Fix type for abs() calls in net/opal

Description

Fix type for abs() calls in net/opal

During the exp-run in bug 208158, it was found that net/opal gives
errors with libc++ 3.8.0 [1]:

../common/mpi.cxx:135:18: error: call to 'abs' is ambiguous

distance = ( abs(MPIs[i].width  - desiredWidth ) *
             ^~~

This is because abs() is being called with unsigned arguments. Fix
this by casting the arguments to the appropriate signed type. This
mimics what happens with older libraries where the only version of
abs() was the one in <stdlib.h>, which is prototyped:
int abs(int)
Correct functioning of this expression relies on how integer overflow
actually behaves, which is actually undefined in the C++ standard.

PR: 209077
Submitted by: dim

Details

Provenance
truckmanAuthored on
Parents
rP416490: Fix cvename entries
Branches
Unknown
Tags
Unknown