View Revisions: Issue #4413

Summary 0004413: build error with gcc 6.3
Revision 2017-08-14 16:35 by pieper
Description

Use of abs() on a short type gives a build error when using it as an array index on gcc 6.3. Apparently the result of abs() is being treated as a double even though the input variables are of type short.

A fix is to cast the result of abs() resolves the issue:

<pre>
$ (cd EMSegment; svn diff)
Index: AMF/vtkImagePropagateDist.cxx

--- AMF/vtkImagePropagateDist.cxx (revision 17135)
+++ AMF/vtkImagePropagateDist.cxx (working copy)
@@ -61,7 +61,7 @@

#define dist2(a,b,c) (sq[abs(a)]+sq[abs(b)]+sq[abs(c)])
-#define dist(a,b,c) (distance[abs(a)][abs(b)][abs(c)])
+#define dist(a,b,c) (distance[(int)abs(a)][(int)abs(b)][(int)abs(c)])

</pre>

Revision 2017-08-14 16:33 by pieper
Description

Use of abs() on a short type gives a build error when using it as an array index on gcc 6.3. Apparently the result of abs() is being treated as a double even though the input variables are of type short.

A fix is to cast the result of abs() resolves the issue:

$ (cd EMSegment; svn diff)
Index: AMF/vtkImagePropagateDist.cxx

--- AMF/vtkImagePropagateDist.cxx (revision 17135)
+++ AMF/vtkImagePropagateDist.cxx (working copy)
@@ -61,7 +61,7 @@

#define dist2(a,b,c) (sq[abs(a)]+sq[abs(b)]+sq[abs(c)])
-#define dist(a,b,c) (distance[abs(a)][abs(b)][abs(c)])
+#define dist(a,b,c) (distance[(int)abs(a)][(int)abs(b)][(int)abs(c)])