Archived issue #0025429

Invalid use of NULL references

CommunityOCCT:Codingclosed1 public note

Search issues

Description

Original summary: Increased testing failures with Clang 3.4 and later

With newer versions of Clang, the number of bad and failed tests has increased severely. Lots of SIGILLs and SIGFPEs. At least part of the problem is using NULL as a reference (C++ does not allow NULL references), e.g.

inline TColStd_Array1OfReal& BSplCLib::NoWeights()
{
  return (*((TColStd_Array1OfReal*) NULL));
}

Here is a possibly complete list of instances where this occurs:

src/BRep/BRep_CurveRepresentation.cxx:186: return *((Handle(Geom_Curve)*) NULL);
src/BRep/BRep_CurveRepresentation.cxx:211: return *((Handle(Geom_Surface)*) NULL);
src/BRep/BRep_CurveRepresentation.cxx:223: return *((Handle(Geom2d_Curve)*) NULL);
src/BRep/BRep_CurveRepresentation.cxx:234: return *((Handle(Geom2d_Curve)*) NULL);
src/BRep/BRep_CurveRepresentation.cxx:266: return *((GeomAbs_Shape*) NULL);
src/BRep/BRep_CurveRepresentation.cxx:288: return *((Handle(Geom_Surface)*) NULL);
src/BRep/BRep_CurveRepresentation.cxx:300: return *((TopLoc_Location*) NULL);
src/BRep/BRep_CurveRepresentation.cxx:313: return *((Handle(Poly_Polygon3D)*) NULL);
src/BRep/BRep_CurveRepresentation.cxx:335: return *((Handle(Poly_Polygon2D)*) NULL);
src/BRep/BRep_CurveRepresentation.cxx:357: return *((Handle(Poly_PolygonOnTriangulation)*) NULL);
src/BRep/BRep_CurveRepresentation.cxx:393: return *(Handle(Poly_PolygonOnTriangulation)*)NULL;
src/BRep/BRep_CurveRepresentation.cxx:404: return *(Handle(Poly_Triangulation)*)NULL;
src/BRep/BRep_CurveRepresentation.cxx:417: return *((Handle(Poly_Polygon2D)*) NULL);
src/BRep/BRep_PointRepresentation.cxx:136: return *((Handle(Geom_Curve)*) NULL);
src/BRep/BRep_PointRepresentation.cxx:159: return *((Handle(Geom2d_Curve)*) NULL);
src/BRep/BRep_PointRepresentation.cxx:182: return *((Handle(Geom_Surface)*) NULL);
src/BSplCLib/BSplCLib.lxx:38: return (*((TColStd_Array1OfReal*) NULL));
src/BSplCLib/BSplCLib.lxx:48: return (*((TColStd_Array1OfInteger*) NULL));
src/BSplSLib/BSplSLib.lxx:100: return (*((TColStd_Array2OfReal*) NULL));
src/Expr/Expr_BinaryExpression.cxx:77: return *( ( Handle_Expr_GeneralExpression* )NULL );
src/NCollection/NCollection_DoubleMap.hxx:133: return * (TheKey2Type *) NULL; // For compiler
src/NCollection/NCollection_IndexedMap.hxx:123: return * (TheKeyType *) NULL; // This for compiler
src/NCollection/NCollection_Map.hxx:113: return * (TheKeyType *) NULL; // For compiler
src/PLib/PLib.lxx:19: return (*((TColStd_Array1OfReal*) NULL ));
src/PLib/PLib.lxx:24: return (*((TColStd_Array2OfReal*) NULL ));

Public activity

1 archived note

Participants are labeled by their role within this record.

01Commenter 2
The bug should be fixed in scope of #0026042, thus the issue can be closed.

Related records