summarylogtreecommitdiffstats
path: root/gcc49.patch
blob: 2ed74f0282c92a0c8d41bf95fbd2402c275d6918 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
--- a/VTK/Filters/ParallelMPI/vtkDistributedDataFilter.cxx	2014-09-23 16:47:10.000000000 +0200
+++ b/VTK/Filters/ParallelMPI/vtkDistributedDataFilter.cxx	2014-12-22 10:31:13.575228267 +0100
@@ -1091,7 +1091,10 @@
   vtkIdType cellsPerNode = numTotalCells / nprocs;
 
   vtkIdList **sendCells = new vtkIdList * [ nprocs ];
-  memset(sendCells, 0, sizeof(vtkIdList *) * nprocs);
+  
+  if (sizeof(vtkIdList *) * nprocs > 0) {
+    memset(sendCells, 0, sizeof(vtkIdList *) * nprocs);
+  }
 
   if (numConsumers == nprocs - 1)
     {
@@ -1582,7 +1585,9 @@
   // Exchange int arrays
 
   float **recvArrays = new float * [nprocs];
-  memset(recvArrays, 0, sizeof(float *) * nprocs);
+  if (sizeof(float *) * nprocs > 0) {
+    memset(recvArrays, 0, sizeof(float *) * nprocs);
+  }
 
   if (sendSize[me] > 0)  // sent myself an array
     {
@@ -1703,7 +1708,9 @@
   // Exchange int arrays
 
   vtkIdType **recvArrays = new vtkIdType * [nprocs];
-  memset(recvArrays, 0, sizeof(vtkIdType *) * nprocs);
+  if (sizeof(vtkIdType *) * nprocs > 0) {
+    memset(recvArrays, 0, sizeof(vtkIdType *) * nprocs);
+  }
 
   if (sendSize[me] > 0)  // sent myself an array
     {
@@ -2807,7 +2814,9 @@
 
   unsigned char *vals = new unsigned char [npoints];
 
-  memset(vals, val, npoints);
+  if (npoints > 0) {
+    memset(vals, val, npoints);
+  }
 
   vtkUnsignedCharArray *Array = vtkUnsignedCharArray::New();
   Array->SetName(arrayName);
@@ -2827,7 +2836,9 @@
 
   unsigned char *vals = new unsigned char [ncells];
 
-  memset(vals, val, ncells);
+  if (ncells > 0) {
+    memset(vals, val, ncells);
+  }
 
   vtkUnsignedCharArray *Array = vtkUnsignedCharArray::New();
   Array->SetName(arrayName);
@@ -3026,7 +3037,9 @@
   vtkIdType nGridPoints = grid->GetNumberOfPoints();
 
   vtkIdType *numPointsOutside = new vtkIdType [nprocs];
-  memset(numPointsOutside, 0, sizeof(vtkIdType) * nprocs);
+  if (sizeof(vtkIdType) * nprocs > 0) {
+    memset(numPointsOutside, 0, sizeof(vtkIdType) * nprocs);
+  }
 
   vtkIdTypeArray *globalIds = vtkIdTypeArray::New();
   globalIds->SetNumberOfValues(nGridPoints);
@@ -3108,10 +3121,16 @@
   // global ID back?
 
   vtkFloatArray **ptarrayOut = new vtkFloatArray * [nprocs];
-  memset(ptarrayOut, 0, sizeof(vtkFloatArray *) * nprocs);
+  
+  if (sizeof(vtkFloatArray *) * nprocs > 0) {
+    memset(ptarrayOut, 0, sizeof(vtkFloatArray *) * nprocs);
+  }
 
   vtkIdTypeArray **localIds     = new vtkIdTypeArray * [nprocs];
-  memset(localIds, 0, sizeof(vtkIdTypeArray *) * nprocs);
+  
+  if (sizeof(vtkIdTypeArray *) * nprocs > 0) {
+    memset(localIds, 0, sizeof(vtkIdTypeArray *) * nprocs);
+  }
 
   vtkIdType *next = new vtkIdType [nprocs];
   vtkIdType *next3 = new vtkIdType [nprocs];
@@ -3286,7 +3305,9 @@
     {
     // There are no cells in my assigned region
 
-    memset(gids, 0, sizeof(vtkIdTypeArray *) * nprocs);
+    if (sizeof(vtkIdTypeArray *) * nprocs > 0) {
+      memset(gids, 0, sizeof(vtkIdTypeArray *) * nprocs);
+    }
 
     return gids;
     }
@@ -3491,7 +3512,10 @@
   std::multimap<int, int>::iterator mapIt;
 
   vtkIdTypeArray **processList = new vtkIdTypeArray * [nprocs];
-  memset(processList, 0, sizeof (vtkIdTypeArray *) * nprocs);
+
+  if (sizeof (vtkIdTypeArray *) * nprocs > 0) {
+    memset(processList, 0, sizeof (vtkIdTypeArray *) * nprocs);
+  }
 
   for (int i=0; i<nprocs; i++)
     {
@@ -3581,7 +3605,9 @@
   vtkIdType numPoints = grid->GetNumberOfPoints();
 
   vtkIdTypeArray **ghostPtIds = new vtkIdTypeArray * [nprocs];
-  memset(ghostPtIds, 0, sizeof(vtkIdTypeArray *) * nprocs);
+  if (sizeof(vtkIdTypeArray *) * nprocs) {
+    memset(ghostPtIds, 0, sizeof(vtkIdTypeArray *) * nprocs);
+  }
 
   if (numPoints < 1)
     {