Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Jun 2016 23:55:08 +0000 (UTC)
From:      Don Lewis <truckman@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r416491 - head/net/opal/files
Message-ID:  <201606062355.u56Nt8jn080709@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: truckman
Date: Mon Jun  6 23:55:08 2016
New Revision: 416491
URL: https://svnweb.freebsd.org/changeset/ports/416491

Log:
  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

Added:
  head/net/opal/files/patch-plugins_video_common_mpi.cxx   (contents, props changed)

Added: head/net/opal/files/patch-plugins_video_common_mpi.cxx
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/net/opal/files/patch-plugins_video_common_mpi.cxx	Mon Jun  6 23:55:08 2016	(r416491)
@@ -0,0 +1,13 @@
+--- plugins/video/common/mpi.cxx.orig	2013-02-20 02:18:05 UTC
++++ plugins/video/common/mpi.cxx
+@@ -132,8 +132,8 @@ bool MPIList::getNegotiatedMPI( unsigned
+   // to the desired one or matches it
+   for (i=0; i < MPIs.size(); i++) {
+     // we square the value in order to get absolute distances
+-    distance = ( abs(MPIs[i].width  - desiredWidth ) *
+-                 abs(MPIs[i].height - desiredHeight) );
++    distance = ( abs((int)(MPIs[i].width  - desiredWidth )) *
++                 abs((int)(MPIs[i].height - desiredHeight)) );
+ 
+     if (distance < minDistance) {
+       minDistance = distance;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606062355.u56Nt8jn080709>