Gentoo Archives: gentoo-commits

From: "Justin Lecher (jlec)" <jlec@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sci-libs/vtk/files: vtk-6.1.0-memset.patch
Date: Mon, 09 Feb 2015 07:55:35
Message-Id: 20150209075531.2021211610@oystercatcher.gentoo.org
1 jlec 15/02/09 07:55:31
2
3 Added: vtk-6.1.0-memset.patch
4 Log:
5 Fix link problems due to fatal warnings, #534096 & #538782
6
7 (Portage version: 2.2.15/cvs/Linux x86_64, signed Manifest commit with key B9D4F231BD1558AB!)
8
9 Revision Changes Path
10 1.1 sci-libs/vtk/files/vtk-6.1.0-memset.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sci-libs/vtk/files/vtk-6.1.0-memset.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sci-libs/vtk/files/vtk-6.1.0-memset.patch?rev=1.1&content-type=text/plain
14
15 Index: vtk-6.1.0-memset.patch
16 ===================================================================
17 From ef22d3d69421581b33bc0cd94b647da73b61ba96 Mon Sep 17 00:00:00 2001
18 From: Anton Gladky <gladk@××××××.org>
19 Date: Fri, 30 May 2014 23:16:26 +0200
20 Subject: [PATCH] Fix compilation by gcc-4.9
21
22 VTK fails to build during compilation by gcc-4.9 with the
23 following message:
24
25 CMakeFiles/vtkFiltersParallelMPI.dir/vtkDistributedDataFilter.cxx.o: In
26 function `memset':
27 /usr/include/x86_64-linux-gnu/bits/string3.h:81: warning: memset used
28 with constant zero length parameter; this could be due to transposed
29 parameters
30 collect2: error: ld returned 1 exit status
31
32 This patch sets if-condition before all "memsets" in
33 vtkDistributedDataFilter and checkes, whether the number
34 of bytes to be set by memset is more than 0 to escape this
35 error.
36 ---
37 Filters/ParallelMPI/vtkDistributedDataFilter.cxx | 48 ++++++++++++++++++------
38 1 file changed, 37 insertions(+), 11 deletions(-)
39
40 diff --git a/Filters/ParallelMPI/vtkDistributedDataFilter.cxx b/Filters/ParallelMPI/vtkDistributedDataFilter.cxx
41 index 3c1ff30..df4b5d3 100644
42 --- a/Filters/ParallelMPI/vtkDistributedDataFilter.cxx
43 +++ b/Filters/ParallelMPI/vtkDistributedDataFilter.cxx
44 @@ -1091,7 +1091,10 @@ vtkDataSet *vtkDistributedDataFilter::TestFixTooFewInputFiles(vtkDataSet *input)
45 vtkIdType cellsPerNode = numTotalCells / nprocs;
46
47 vtkIdList **sendCells = new vtkIdList * [ nprocs ];
48 - memset(sendCells, 0, sizeof(vtkIdList *) * nprocs);
49 +
50 + if (sizeof(vtkIdList *) * nprocs > 0) {
51 + memset(sendCells, 0, sizeof(vtkIdList *) * nprocs);
52 + }
53
54 if (numConsumers == nprocs - 1)
55 {
56 @@ -1582,7 +1585,9 @@ vtkFloatArray **
57 // Exchange int arrays
58
59 float **recvArrays = new float * [nprocs];
60 - memset(recvArrays, 0, sizeof(float *) * nprocs);
61 + if (sizeof(float *) * nprocs > 0) {
62 + memset(recvArrays, 0, sizeof(float *) * nprocs);
63 + }
64
65 if (sendSize[me] > 0) // sent myself an array
66 {
67 @@ -1703,7 +1708,9 @@ vtkIdTypeArray **
68 // Exchange int arrays
69
70 vtkIdType **recvArrays = new vtkIdType * [nprocs];
71 - memset(recvArrays, 0, sizeof(vtkIdType *) * nprocs);
72 + if (sizeof(vtkIdType *) * nprocs > 0) {
73 + memset(recvArrays, 0, sizeof(vtkIdType *) * nprocs);
74 + }
75
76 if (sendSize[me] > 0) // sent myself an array
77 {
78 @@ -2807,7 +2814,9 @@ void vtkDistributedDataFilter::AddConstantUnsignedCharPointArray(
79
80 unsigned char *vals = new unsigned char [npoints];
81
82 - memset(vals, val, npoints);
83 + if (npoints > 0) {
84 + memset(vals, val, npoints);
85 + }
86
87 vtkUnsignedCharArray *Array = vtkUnsignedCharArray::New();
88 Array->SetName(arrayName);
89 @@ -2827,7 +2836,9 @@ void vtkDistributedDataFilter::AddConstantUnsignedCharCellArray(
90
91 unsigned char *vals = new unsigned char [ncells];
92
93 - memset(vals, val, ncells);
94 + if (ncells > 0) {
95 + memset(vals, val, ncells);
96 + }
97
98 vtkUnsignedCharArray *Array = vtkUnsignedCharArray::New();
99 Array->SetName(arrayName);
100 @@ -3026,7 +3037,9 @@ int vtkDistributedDataFilter::AssignGlobalNodeIds(vtkUnstructuredGrid *grid)
101 vtkIdType nGridPoints = grid->GetNumberOfPoints();
102
103 vtkIdType *numPointsOutside = new vtkIdType [nprocs];
104 - memset(numPointsOutside, 0, sizeof(vtkIdType) * nprocs);
105 + if (sizeof(vtkIdType) * nprocs > 0) {
106 + memset(numPointsOutside, 0, sizeof(vtkIdType) * nprocs);
107 + }
108
109 vtkIdTypeArray *globalIds = vtkIdTypeArray::New();
110 globalIds->SetNumberOfValues(nGridPoints);
111 @@ -3108,10 +3121,16 @@ int vtkDistributedDataFilter::AssignGlobalNodeIds(vtkUnstructuredGrid *grid)
112 // global ID back?
113
114 vtkFloatArray **ptarrayOut = new vtkFloatArray * [nprocs];
115 - memset(ptarrayOut, 0, sizeof(vtkFloatArray *) * nprocs);
116 +
117 + if (sizeof(vtkFloatArray *) * nprocs > 0) {
118 + memset(ptarrayOut, 0, sizeof(vtkFloatArray *) * nprocs);
119 + }
120
121 vtkIdTypeArray **localIds = new vtkIdTypeArray * [nprocs];
122 - memset(localIds, 0, sizeof(vtkIdTypeArray *) * nprocs);
123 +
124 + if (sizeof(vtkIdTypeArray *) * nprocs > 0) {
125 + memset(localIds, 0, sizeof(vtkIdTypeArray *) * nprocs);
126 + }
127
128 vtkIdType *next = new vtkIdType [nprocs];
129 vtkIdType *next3 = new vtkIdType [nprocs];
130 @@ -3286,7 +3305,9 @@ vtkIdTypeArray **vtkDistributedDataFilter::FindGlobalPointIds(
131 {
132 // There are no cells in my assigned region
133
134 - memset(gids, 0, sizeof(vtkIdTypeArray *) * nprocs);
135 + if (sizeof(vtkIdTypeArray *) * nprocs > 0) {
136 + memset(gids, 0, sizeof(vtkIdTypeArray *) * nprocs);
137 + }
138
139 return gids;
140 }
141 @@ -3491,7 +3512,10 @@ vtkIdTypeArray **vtkDistributedDataFilter::MakeProcessLists(
142 std::multimap<int, int>::iterator mapIt;
143
144 vtkIdTypeArray **processList = new vtkIdTypeArray * [nprocs];
145 - memset(processList, 0, sizeof (vtkIdTypeArray *) * nprocs);
146 +
147 + if (sizeof (vtkIdTypeArray *) * nprocs > 0) {
148 + memset(processList, 0, sizeof (vtkIdTypeArray *) * nprocs);
149 + }
150
151 for (int i=0; i<nprocs; i++)
152 {
153 @@ -3581,7 +3605,9 @@ vtkIdTypeArray **vtkDistributedDataFilter::GetGhostPointIds(
154 vtkIdType numPoints = grid->GetNumberOfPoints();
155
156 vtkIdTypeArray **ghostPtIds = new vtkIdTypeArray * [nprocs];
157 - memset(ghostPtIds, 0, sizeof(vtkIdTypeArray *) * nprocs);
158 + if (sizeof(vtkIdTypeArray *) * nprocs) {
159 + memset(ghostPtIds, 0, sizeof(vtkIdTypeArray *) * nprocs);
160 + }
161
162 if (numPoints < 1)
163 {