summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/oce/null.patch
blob: 42a3f0e44f33466a12a4ab52d6e79ab0efd67f20 (plain) (blame)
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
From 61cb965b9ffeca419005bc15e635e67589c421dd Mon Sep 17 00:00:00 2001
From: Martin Siggel <martin.siggel@dlr.de>
Date: Thu, 28 Jan 2016 19:05:00 +0100
Subject: [PATCH] Workaround clang optimizations for null references

OCCT/OCE includes some evil code that uses NULL references,
which are normally not possible. Clang removes code in
branches like if(&myNullRef==NULL) as it assumes this can
never be true. This fix was inspired from the mantis issue
http://tracker.dev.opencascade.org/view.php?id=26042. This
code will be fixed in OCCT 7, but we might require the fix
for earlier releases as well.

Fixes issue #576
---
 inc/PLib.hxx                               |  2 +-
 src/BSplCLib/BSplCLib.cxx                  | 16 ++++++-------
 src/BSplCLib/BSplCLib_2.cxx                |  6 ++---
 src/BSplCLib/BSplCLib_CurveComputation.gxx | 26 ++++++++++-----------
 src/BSplSLib/BSplSLib.cxx                  | 36 +++++++++++++++---------------
 src/BSplSLib/BSplSLib_BzSyntaxes.cxx       |  2 +-
 src/PLib/PLib.cxx                          | 10 ++++-----
 7 files changed, 49 insertions(+), 49 deletions(-)

diff --git a/inc/PLib.hxx b/inc/PLib.hxx
index 7513234..52b1f84 100644
--- a/inc/PLib.hxx
+++ b/inc/PLib.hxx
@@ -343,6 +343,6 @@ friend class PLib_DoubleJacobiPolynomial;
 
 
 
-
+#define IS_NULL_REF(ref) ((reinterpret_cast<size_t>(&ref) & 0xFFFFFF) == 0)
 
 #endif // _PLib_HeaderFile
diff --git a/src/BSplCLib/BSplCLib.cxx b/src/BSplCLib/BSplCLib.cxx
index 683e4ab..2a2d9ea 100644
--- a/src/BSplCLib/BSplCLib.cxx
+++ b/src/BSplCLib/BSplCLib.cxx
@@ -298,7 +298,7 @@ void BSplCLib::LocateParameter
  Standard_Real&                 NewU) 
 {
   Standard_Integer first,last;
-  if (&Mults) {
+  if (!IS_NULL_REF(Mults)) {
     if (Periodic) {
       first = Knots.Lower();
       last  = Knots.Upper();
@@ -1434,7 +1434,7 @@ void BSplCLib::BuildKnots(const Standard_Integer         Degree,
   const Standard_Real * pkn = &Knots(KLower);
   pkn -= KLower;
   Standard_Real *knot = &LK;
-  if (&Mults == NULL) {
+  if (IS_NULL_REF(Mults)) {
     switch (Degree) {
     case 1 : {
       Standard_Integer j = Index    ;
@@ -1672,7 +1672,7 @@ Standard_Boolean  BSplCLib::PrepareInsertKnots
  const Standard_Real            Tolerance,
  const Standard_Boolean         Add)
 {
-  Standard_Boolean addflat = &AddMults == NULL;
+  Standard_Boolean addflat = IS_NULL_REF(AddMults);
   
   Standard_Integer first,last;
   if (Periodic) {
@@ -1856,7 +1856,7 @@ void BSplCLib::InsertKnots
  const Standard_Real            Tolerance,
  const Standard_Boolean         Add)
 {
-  Standard_Boolean addflat  = &AddMults == NULL;
+  Standard_Boolean addflat  = IS_NULL_REF(AddMults);
   
   Standard_Integer i,k,mult,firstmult;
   Standard_Integer index,kn,curnk,curk;
@@ -3902,7 +3902,7 @@ void BSplCLib::Resolution(      Standard_Real&        Poles,
   num_poles = FlatKnots.Length() - Deg1;
   switch (ArrayDimension) {
   case 2 : {
-    if (&Weights != NULL) {
+    if (!IS_NULL_REF(Weights)) {
       const Standard_Real * WG = &Weights(Weights.Lower());
       min_weights = WG[0];
       
@@ -3970,7 +3970,7 @@ void BSplCLib::Resolution(      Standard_Real&        Poles,
     break;
   }
   case 3 : {
-    if (&Weights != NULL) {
+    if (!IS_NULL_REF(Weights)) {
       const Standard_Real * WG = &Weights(Weights.Lower());
       min_weights = WG[0];
       
@@ -4047,7 +4047,7 @@ void BSplCLib::Resolution(      Standard_Real&        Poles,
     break;
   }
   case 4 : {
-    if (&Weights != NULL) {
+    if (!IS_NULL_REF(Weights)) {
       const Standard_Real * WG = &Weights(Weights.Lower());
       min_weights = WG[0];
       
@@ -4134,7 +4134,7 @@ void BSplCLib::Resolution(      Standard_Real&        Poles,
   }
     default : {
       Standard_Integer kk;
-      if (&Weights != NULL) {
+      if (!IS_NULL_REF(Weights)) {
 	const Standard_Real * WG = &Weights(Weights.Lower());
 	min_weights = WG[0];
 	
diff --git a/src/BSplCLib/BSplCLib_2.cxx b/src/BSplCLib/BSplCLib_2.cxx
index 35c4639..653b7cd 100644
--- a/src/BSplCLib/BSplCLib_2.cxx
+++ b/src/BSplCLib/BSplCLib_2.cxx
@@ -70,7 +70,7 @@ void  BSplCLib::BuildEval(const Standard_Integer         Degree,
   Standard_Integer i;
   Standard_Integer ip = PLower + Index - 1;
   Standard_Real w, *pole = &LP;
-  if (&Weights == NULL) {
+  if (IS_NULL_REF(Weights)) {
     
     for (i = 0; i <= Degree; i++) {
       ip++;
@@ -115,13 +115,13 @@ static void PrepareEval
   
   // make the knots
   BSplCLib::BuildKnots(Degree,index,Periodic,Knots,Mults,*dc.knots);
-  if (&Mults == NULL)
+  if (IS_NULL_REF(Mults))
     index -= Knots.Lower() + Degree;
   else
     index = BSplCLib::PoleIndex(Degree,index,Periodic,Mults);
   
   // check truly rational
-  rational = (&Weights != NULL);
+  rational = (!IS_NULL_REF(Weights));
   if (rational) {
     Standard_Integer WLower = Weights.Lower() + index;
     rational = BSplCLib::IsRational(Weights, WLower, WLower + Degree);
diff --git a/src/BSplCLib/BSplCLib_CurveComputation.gxx b/src/BSplCLib/BSplCLib_CurveComputation.gxx
index e71b4e0..9d42643 100644
--- a/src/BSplCLib/BSplCLib_CurveComputation.gxx
+++ b/src/BSplCLib/BSplCLib_CurveComputation.gxx
@@ -92,7 +92,7 @@ Standard_Boolean BSplCLib::RemoveKnot
  TColStd_Array1OfInteger&       NewMults,
  const Standard_Real            Tolerance) 
 {
-  Standard_Boolean rational = &Weights  != NULL;
+  Standard_Boolean rational = !IS_NULL_REF(Weights);
   Standard_Integer dim;
   dim = Dimension_gen;
   if (rational) dim++;
@@ -133,7 +133,7 @@ void BSplCLib::InsertKnots
  const Standard_Real            Epsilon,
  const Standard_Boolean         Add) 
 {
-  Standard_Boolean rational = &Weights  != NULL;
+  Standard_Boolean rational = !IS_NULL_REF(Weights);
   Standard_Integer dim;
   dim = Dimension_gen;
   if (rational) dim++;
@@ -222,7 +222,7 @@ void BSplCLib::IncreaseDegree
  TColStd_Array1OfReal&           NewKnots,
  TColStd_Array1OfInteger&        NewMults) 
 {
-  Standard_Boolean rational = &Weights  != NULL;
+  Standard_Boolean rational = !IS_NULL_REF(Weights);
   Standard_Integer dim;
   dim = Dimension_gen;
   if (rational) dim++;
@@ -256,7 +256,7 @@ void  BSplCLib::Unperiodize
  Array1OfPoints&          NewPoles,
  TColStd_Array1OfReal&    NewWeights)
 {
-  Standard_Boolean rational = &Weights  != NULL;
+  Standard_Boolean rational = !IS_NULL_REF(Weights);
   Standard_Integer dim;
   dim = Dimension_gen;
   if (rational) dim++;
@@ -292,7 +292,7 @@ void BSplCLib::Trimming(const Standard_Integer         Degree,
 			Array1OfPoints&          NewPoles,
 			TColStd_Array1OfReal&    NewWeights)
 {
-  Standard_Boolean rational = &Weights  != NULL;
+  Standard_Boolean rational = !IS_NULL_REF(Weights);
   Standard_Integer dim;
   dim = Dimension_gen;
   if (rational) dim++;
@@ -339,7 +339,7 @@ void  BSplCLib::BuildEval(const Standard_Integer         Degree,
   Standard_Integer PUpper = Poles.Upper();
   Standard_Integer i;
   Standard_Integer ip = PLower + Index - 1;
-  if (&Weights == NULL) {
+  if (IS_NULL_REF(Weights)) {
     for (i = 0; i <= Degree; i++) {
       ip++;
       if (ip > PUpper) ip = PLower;
@@ -384,13 +384,13 @@ static void PrepareEval
 
   // make the knots
   BSplCLib::BuildKnots(Degree,index,Periodic,Knots,Mults,*dc.knots);
-  if (&Mults == NULL)
+  if (IS_NULL_REF(Mults))
     index -= Knots.Lower() + Degree;
   else
     index = BSplCLib::PoleIndex(Degree,index,Periodic,Mults);
   
   // check truly rational
-  rational = (&Weights != NULL);
+  rational = (!IS_NULL_REF(Weights));
   if (rational) {
     Standard_Integer WLower = Weights.Lower() + index;
     rational = BSplCLib::IsRational(Weights, WLower, WLower + Degree);
@@ -741,7 +741,7 @@ void  BSplCLib::CacheD0(const Standard_Real                  Parameter,
 		       Degree * Dimension_gen,
 		       PArray[0],
 		       myPoint[0]) ;
-  if (&WeightsArray != NULL) {
+  if (!IS_NULL_REF(WeightsArray)) {
     Standard_Real *
       WArray = (Standard_Real *) &WeightsArray(WeightsArray.Lower()) ;
     PLib::NoDerivativeEvalPolynomial(NewParameter,
@@ -798,7 +798,7 @@ void  BSplCLib::CacheD1(const Standard_Real                  Parameter,
 
   ModifyCoords (LocalPDerivatives + Dimension_gen, /= SpanLenght);
   
-  if (&WeightsArray != NULL) {
+  if (!IS_NULL_REF(WeightsArray)) {
     Standard_Real *
       WArray = (Standard_Real *) &WeightsArray(WeightsArray.Lower()) ;
     PLib::EvalPolynomial(NewParameter,
@@ -878,7 +878,7 @@ void  BSplCLib::CacheD2(const Standard_Real                  Parameter,
     Index += Dimension_gen;
   }
 
-  if (&WeightsArray != NULL) {
+  if (!IS_NULL_REF(WeightsArray)) {
     Standard_Real *
       WArray = (Standard_Real *) &WeightsArray(WeightsArray.Lower()) ;
     
@@ -971,7 +971,7 @@ void  BSplCLib::CacheD3(const Standard_Real                  Parameter,
     Index  += Dimension_gen;
   }
   
-  if (&WeightsArray != NULL) {
+  if (!IS_NULL_REF(WeightsArray)) {
     Standard_Real *
       WArray = (Standard_Real *) &WeightsArray(WeightsArray.Lower()) ;
     
@@ -1081,7 +1081,7 @@ void BSplCLib::BuildCache
       LocalValue *= SpanDomain / (Standard_Real) ii ;
     }
 
-    if (&Weights != NULL) { 
+    if (!IS_NULL_REF(Weights)) {
       for (ii = 1 ; ii <= Degree + 1 ; ii++)
 	CacheWeights(ii) = 0.0e0 ;
       CacheWeights(1) = 1.0e0 ;
diff --git a/src/BSplSLib/BSplSLib.cxx b/src/BSplSLib/BSplSLib.cxx
index 5ad633c..07040d5 100644
--- a/src/BSplSLib/BSplSLib.cxx
+++ b/src/BSplSLib/BSplSLib.cxx
@@ -309,12 +309,12 @@ static Standard_Boolean  PrepareEval (const Standard_Real            U,
     BSplCLib::BuildKnots(UDegree,uindex,UPer,UKnots,UMults,*dc.knots1);
     BSplCLib::BuildKnots(VDegree,vindex,VPer,VKnots,VMults,*dc.knots2);
     
-    if (&UMults == NULL)
+    if (IS_NULL_REF(UMults))
       uindex -= UKLower + UDegree;
     else
       uindex  = BSplCLib::PoleIndex(UDegree,uindex,UPer,UMults);
 
-    if (&VMults == NULL)
+    if (IS_NULL_REF(VMults))
       vindex -= VKLower + VDegree;
     else
       vindex  = BSplCLib::PoleIndex(VDegree,vindex,VPer,VMults);
@@ -460,12 +460,12 @@ static Standard_Boolean  PrepareEval (const Standard_Real            U,
     BSplCLib::BuildKnots(UDegree,uindex,UPer,UKnots,UMults,*dc.knots2);
     BSplCLib::BuildKnots(VDegree,vindex,VPer,VKnots,VMults,*dc.knots1);
 
-    if (&UMults == NULL)
+    if (IS_NULL_REF(UMults))
       uindex -= UKLower + UDegree;
     else
       uindex  = BSplCLib::PoleIndex(UDegree,uindex,UPer,UMults);
 
-    if (&VMults == NULL)
+    if (IS_NULL_REF(VMults))
       vindex -= VKLower + VDegree;
     else
       vindex  = BSplCLib::PoleIndex(VDegree,vindex,VPer,VMults);
@@ -1299,7 +1299,7 @@ void  BSplSLib::Iso(const Standard_Real            Param,
 {
   Standard_Integer index = 0;
   Standard_Real    u = Param;
-  Standard_Boolean rational = &Weights != NULL;
+  Standard_Boolean rational = !IS_NULL_REF(Weights);
   Standard_Integer dim = rational ? 4 : 3;
   
   // compute local knots
@@ -1307,7 +1307,7 @@ void  BSplSLib::Iso(const Standard_Real            Param,
   NCollection_LocalArray<Standard_Real> locknots1 (2*Degree);  
   BSplCLib::LocateParameter(Degree,Knots,Mults,u,Periodic,index,u);
   BSplCLib::BuildKnots(Degree,index,Periodic,Knots,Mults,*locknots1);
-  if (&Mults == NULL)
+  if (IS_NULL_REF(Mults))
     index -= Knots.Lower() + Degree;
   else
     index = BSplCLib::PoleIndex(Degree,index,Periodic,Mults);
@@ -1381,7 +1381,7 @@ void  BSplSLib::Iso(const Standard_Real            Param,
   }
   
   // if the input is not rational but weights are wanted
-  if (!rational && (&CWeights != NULL)) {
+  if (!rational && (!IS_NULL_REF(CWeights))) {
 
     for (i = CWeights.Lower(); i <= CWeights.Upper(); i++)
       CWeights(i) = 1.;
@@ -1741,7 +1741,7 @@ void  BSplSLib::InsertKnots(const Standard_Boolean         UDirection,
 			    const Standard_Real            Epsilon, 
 			    const Standard_Boolean         Add )
 {
-  Standard_Boolean rational = &Weights != NULL;
+  Standard_Boolean rational = !IS_NULL_REF(Weights);
   Standard_Integer dim = 3;
   if (rational) dim++;
   
@@ -1787,7 +1787,7 @@ Standard_Boolean  BSplSLib::RemoveKnot
  TColStd_Array1OfInteger& NewMults,
  const Standard_Real            Tolerance)
 {
-  Standard_Boolean rational = &Weights != NULL;
+  Standard_Boolean rational = !IS_NULL_REF(Weights);
   Standard_Integer dim = 3;
   if (rational) dim++;
   
@@ -1834,7 +1834,7 @@ void  BSplSLib::IncreaseDegree
  TColStd_Array1OfReal&    NewKnots, 
  TColStd_Array1OfInteger& NewMults)
 {
-  Standard_Boolean rational = &Weights != NULL;
+  Standard_Boolean rational = !IS_NULL_REF(Weights);
   Standard_Integer dim = 3;
   if (rational) dim++;
   
@@ -1876,7 +1876,7 @@ void  BSplSLib::Unperiodize
  TColgp_Array2OfPnt&      NewPoles,
  TColStd_Array2OfReal&    NewWeights)
 {
-  Standard_Boolean rational = &Weights != NULL;
+  Standard_Boolean rational = !IS_NULL_REF(Weights);
   Standard_Integer dim = 3;
   if (rational) dim++;
   
@@ -1929,7 +1929,7 @@ void BSplSLib::BuildCache
   Standard_Boolean rational,rational_u,rational_v,flag_u_or_v;                  
   Standard_Integer kk,d1,d1p1,d2,d2p1,ii,jj,iii,jjj,Index;
   Standard_Real u1,min_degree_domain,max_degree_domain,f,factor[2],u2;
-  if (&Weights != NULL) 
+  if (!IS_NULL_REF(Weights))
     rational_u = rational_v = Standard_True;
   else
     rational_u = rational_v = Standard_False;
@@ -2025,7 +2025,7 @@ void BSplSLib::BuildCache
       }
       factor[0] *= max_degree_domain / (Standard_Real) (iii) ;
     }
-    if (&Weights != NULL) {
+    if (!IS_NULL_REF(Weights)) {
       //
       // means that PrepareEval did found out that the surface was 
       // locally polynomial but since the surface is constructed
@@ -2110,7 +2110,7 @@ void  BSplSLib::CacheD0(const Standard_Real                  UParameter,
 		       (min_degree << 1) + min_degree,
 		       locpoles[0],
 		       myPoint[0]) ;
-  if (&WeightsArray != NULL) {
+  if (!IS_NULL_REF(WeightsArray)) {
     dimension = min_degree + 1 ;
     Standard_Real *
       WArray = (Standard_Real *) 
@@ -2190,7 +2190,7 @@ void  BSplSLib::CacheD1(const Standard_Real                  UParameter,
   // the coefficients
   //
   //
-  if (&WeightsArray != NULL) {
+  if (!IS_NULL_REF(WeightsArray)) {
 
     local_poles_array            [0][0][0] = 0.0e0 ;
     local_poles_array            [0][0][1] = 0.0e0 ;
@@ -2275,7 +2275,7 @@ void  BSplSLib::CacheD1(const Standard_Real                  UParameter,
 		       locpoles[dimension],
 		       local_poles_array[1][0][0]) ;
   
-  if (&WeightsArray != NULL) {
+  if (!IS_NULL_REF(WeightsArray)) {
     dimension = min_degree + 1 ;
     Standard_Real *
       WArray = (Standard_Real *) 
@@ -2435,7 +2435,7 @@ void  BSplSLib::CacheD2(const Standard_Real                  UParameter,
   // the coefficients
   //
   //
-  if (&WeightsArray != NULL) {
+  if (!IS_NULL_REF(WeightsArray)) {
     
     local_poles_and_weights_array[0][0][0] = 0.0e0 ;
     local_poles_and_weights_array[0][0][1] = 0.0e0 ;
@@ -2564,7 +2564,7 @@ void  BSplSLib::CacheD2(const Standard_Real                  UParameter,
 		       locpoles[dimension + dimension],
 		       local_poles_array[2][0][0]) ;
   
-  if (&WeightsArray != NULL) {
+  if (!IS_NULL_REF(WeightsArray)) {
     dimension = min_degree + 1 ;
     Standard_Real *
       WArray = (Standard_Real *) 
diff --git a/src/BSplSLib/BSplSLib_BzSyntaxes.cxx b/src/BSplSLib/BSplSLib_BzSyntaxes.cxx
index 0faf6b6..f2c0f74 100644
--- a/src/BSplSLib/BSplSLib_BzSyntaxes.cxx
+++ b/src/BSplSLib/BSplSLib_BzSyntaxes.cxx
@@ -68,7 +68,7 @@ void BSplSLib::PolesCoefficients (const TColgp_Array2OfPnt& Poles,
 			 biduflatknots,bidvflatknots,
 			 Poles,Weights,
 			 CPoles,CWeights);
-    if (&Weights == NULL) {
+    if (IS_NULL_REF(Weights)) {
       
       for (ii = 1; ii <= uclas; ii++) {
 	
diff --git a/src/PLib/PLib.cxx b/src/PLib/PLib.cxx
index 23fa302..7ee231f 100644
--- a/src/PLib/PLib.cxx
+++ b/src/PLib/PLib.cxx
@@ -2427,7 +2427,7 @@ void PLib::CoefficientsPoles (const Standard_Integer      dim,
 			      TColStd_Array1OfReal&       Poles, 
 			      TColStd_Array1OfReal&       Weights)
 {
-  Standard_Boolean rat = &WCoefs != NULL;
+  Standard_Boolean rat = !IS_NULL_REF(WCoefs);
   Standard_Integer loc = Coefs.Lower();
   Standard_Integer lop = Poles.Lower();
   Standard_Integer lowc=0;
@@ -2550,7 +2550,7 @@ void PLib::Trimming(const Standard_Real U1,
   Standard_Integer indc, indw=0;
   Standard_Integer upc = Coefs.Upper() - dim + 1, upw=0;
   Standard_Integer len = Coefs.Length()/dim;
-  Standard_Boolean rat = &WCoefs != NULL;
+  Standard_Boolean rat = !IS_NULL_REF(WCoefs);
 
   if (rat) {
     if(len != WCoefs.Length())
@@ -2607,7 +2607,7 @@ void PLib::CoefficientsPoles (const TColgp_Array2OfPnt&   Coefs,
 			      TColgp_Array2OfPnt&         Poles,
 			      TColStd_Array2OfReal&       Weights) 
 {
-  Standard_Boolean rat = (&WCoefs != NULL);
+  Standard_Boolean rat = (!IS_NULL_REF(WCoefs));
   Standard_Integer LowerRow  = Poles.LowerRow();
   Standard_Integer UpperRow  = Poles.UpperRow();
   Standard_Integer LowerCol  = Poles.LowerCol();
@@ -2701,7 +2701,7 @@ void PLib::UTrimming(const Standard_Real U1,
 		     TColgp_Array2OfPnt& Coeffs, 
 		     TColStd_Array2OfReal& WCoeffs)
 {
-  Standard_Boolean rat = &WCoeffs != NULL;
+  Standard_Boolean rat = !IS_NULL_REF(WCoeffs);
   Standard_Integer lr = Coeffs.LowerRow();
   Standard_Integer ur = Coeffs.UpperRow();
   Standard_Integer lc = Coeffs.LowerCol();
@@ -2735,7 +2735,7 @@ void PLib::VTrimming(const Standard_Real V1,
 		     TColgp_Array2OfPnt& Coeffs, 
 		     TColStd_Array2OfReal& WCoeffs)
 {
-  Standard_Boolean rat = &WCoeffs != NULL;
+  Standard_Boolean rat = !IS_NULL_REF(WCoeffs);
   Standard_Integer lr = Coeffs.LowerRow();
   Standard_Integer ur = Coeffs.UpperRow();
   Standard_Integer lc = Coeffs.LowerCol();