View Issue Details

IDProjectCategoryView StatusLast Update
0032678CommunityOCCT:Codingpublic2023-02-03 05:04
Reportergalbramc Assigned Tosmoskvin 
PrioritynormalSeverityminor 
Status closedResolutionfixed 
PlatformLinuxOSUbuntu 
Product Version7.5.0 
Target Version7.7.0Fixed in Version7.7.0 
Summary0032678: Coding Rules, ApproxInt_SvSurfaces - eliminate GCC -fsanitize=undefined error
DescriptionErrors reported by compiling with -fsanitize=undefined using g++ 11 (as well as clang 13 on macOS) and running our test suite:

src/ApproxInt/ApproxInt_SvSurfaces.hxx:92:12: runtime error: load of value 94, which is not a valid value for type 'bool'
src/ApproxInt/ApproxInt_SvSurfaces.hxx:92:12: runtime error: load of value 136, which is not a valid value for type 'bool'
src/ApproxInt/ApproxInt_SvSurfaces.hxx:92:12: runtime error: load of value 88, which is not a valid value for type 'bool'

This looks like it might be an issue of uninitialized data, but I've not looked at it closely.
Steps To ReproduceCompile with "-fsanitize=undefined -fno-omit-frame-pointer" and run your test suite.
TagsNo tags attached.
Test case numberN/A

Activities

git

2021-11-22 02:14

administrator   ~0105335

Branch CR32678 has been created by kgv.

SHA-1: 02ee7507659816e5a3e54d4dc1487ca9f423b929


Detailed log of new commits:

Author: kgv
Date: Mon Nov 22 02:13:56 2021 +0300

    0032678: Coding Rules, ApproxInt_SvSurfaces - eliminate GCC -fsanitize=undefined error

kgv

2021-11-22 02:14

developer   ~0105336

Could you check if this error is caused by uninitialized variable (branch CR32678) or something else?

galbramc

2021-11-22 05:37

reporter   ~0105341

valgrind did sussed out uninitialized data, but I'm not sure if it's the same problem...

==2972465== Conditional jump or move depends on uninitialised value(s)
==2972465== at 0x60AE2DC: GeomInt_TheMultiLineOfWLApprox::MakeMLBetween(int, int, int) const (ApproxInt_MultiLine.gxx:321)
==2972465== by 0x609C98E: GeomInt_TheMultiLineToolOfWLApprox::MakeMLBetween(GeomInt_TheMultiLineOfWLApprox const&, int, int, int) (ApproxInt_MultiLineTool.lxx:116)
==2972465== by 0x60979F0: GeomInt_TheComputeLineBezierOfWLApprox::Perform(GeomInt_TheMultiLineOfWLApprox const&) (Approx_ComputeLine.gxx:941)
==2972465== by 0x60B5F80: GeomInt_WLApprox::buildCurve(opencascade::handle<IntPatch_WLine> const&, void*) (ApproxInt_Approx.gxx:648)
==2972465== by 0x60B4C9F: GeomInt_WLApprox::Perform(opencascade::handle<Adaptor3d_Surface> const&, opencascade::handle<Adaptor3d_Surface> const&, opencascade::handle<IntPatch_WLine> const&, bool, bool, bool, int, int) (ApproxInt_Approx.gxx:337)
==2972465== by 0x5C7A7FB: IntTools_FaceFace::MakeCurve(int, opencascade::handle<Adaptor3d_TopolTool> const&, opencascade::handle<Adaptor3d_TopolTool> const&, double) (IntTools_FaceFace.cxx:1260)
==2972465== by 0x5C7745A: IntTools_FaceFace::Perform(TopoDS_Face const&, TopoDS_Face const&, bool) (IntTools_FaceFace.cxx:561)
==2972465== by 0x5D5F14A: BOPAlgo_FaceFace::Perform() (BOPAlgo_PaveFiller_6.cxx:187)
==2972465== by 0x5D64ACB: BOPTools_Parallel::Functor<NCollection_Vector<BOPAlgo_FaceFace> >::operator()(int) const (BOPTools_Parallel.hxx:40)
==2972465== by 0x5D652AF: OSD_Parallel::FunctorWrapperForThreadPool<BOPTools_Parallel::Functor<NCollection_Vector<BOPAlgo_FaceFace> > >::operator()(int, int) const (OSD_Parallel.hxx:256)
==2972465== by 0x5D6522F: OSD_ThreadPool::Job<OSD_Parallel::FunctorWrapperForThreadPool<BOPTools_Parallel::Functor<NCollection_Vector<BOPAlgo_FaceFace> > > >::Perform(int) (OSD_ThreadPool.hxx:299)
==2972465== by 0x579CBD1: OSD_ThreadPool::performJob(opencascade::handle<Standard_Failure>&, OSD_ThreadPool::JobInterface*, int) (OSD_ThreadPool.cxx:286)
==2972465== Uninitialised value was created by a stack allocation
==2972465== at 0x60B46DB: GeomInt_WLApprox::Perform(opencascade::handle<Adaptor3d_Surface> const&, opencascade::handle<Adaptor3d_Surface> const&, opencascade::handle<IntPatch_WLine> const&, bool, bool, bool, int, int) (ApproxInt_Approx.gxx:230)
==2972465==

galbramc

2021-11-30 22:27

reporter   ~0105548

Any luck with this? Would you like me to try to narrow down which variable on the stack is not initialized in GeomInt_WLApprox::Perform?

kgv

2021-12-01 10:45

developer   ~0105554

If CR32678 doesn't change anything, then no, I don't know yet where to look at.

.gxx files is a legacy of statically generated templates (by WOK), so that apart from cryptic sanitizer logs, it is difficult to read C++ code here - might be better to first rewrite the code with help of C++ templates.

galbramc

2021-12-03 16:30

reporter   ~0105634

Sorry I didn't notice the new constructor the first the I looked at CR32678. Yes this branch does fix both the undefined analyzer warning and valgrind also runs clean. I ran through our entire test suite to double check.

git

2021-12-06 11:47

administrator   ~0105693

Branch CR32678 has been updated forcibly by kgv.

SHA-1: 4381c08132b8b9c7d66748825465554886d684d3

kgv

2021-12-06 11:49

developer   ~0105694

> Yes this branch does fix both the undefined analyzer warning
Great, then let's merge the fix and register new issues of analyzer will find something more.

kgv

2021-12-06 13:46

developer   ~0105696

Please raise the patch
- OCCT: branch CR32678.

http://jenkins-test-12.nnov.opencascade.com:8080/view/CR32678-master-KGV/

galbramc

2021-12-07 01:20

reporter   ~0105710

With this patch, all of our test suite runs clean. I will submit new issues if something comes up in the future. Thank you for all your help!

smoskvin

2021-12-11 11:35

administrator   ~0105806

Combination -
OCCT branch : IR-2021-12-10
master SHA - e463b2f685d8c815f8a7ab996c6843808e8b1430
49e51745631c52b6c452c65adae4d6dfa21a1b1e
Products branch : IR-2021-12-10 SHA - 6377a4e004f3c988c651adf5eca35203f239b1c2
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 18222.380000000427 / 18166.60000000042 [+0.31%]
Products
Total CPU difference: 11645.100000000084 / 11658.820000000103 [-0.12%]
Windows-64-VC14:
OCCT
Total CPU difference: 19999.4375 / 19937.953125 [+0.31%]
Products
Total CPU difference: 13044.453125 / 13069.28125 [-0.19%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

git

2021-12-11 15:26

administrator   ~0105818

Branch CR32678 has been deleted by mnt.

SHA-1: 4381c08132b8b9c7d66748825465554886d684d3

Related Changesets

occt: master 9a529829

2021-11-21 23:13:56

kgv


Committer: smoskvin Details Diff
0032678: Coding Rules, ApproxInt_SvSurfaces - eliminate GCC -fsanitize=undefined error

ApproxInt_SvSurfaces::myUseSolver is now initialized by default constructor.
Affected Issues
0032678
mod - src/ApproxInt/ApproxInt_SvSurfaces.hxx Diff File

Issue History

Date Modified Username Field Change
2021-11-22 02:01 galbramc New Issue
2021-11-22 02:01 galbramc Assigned To => kgv
2021-11-22 02:13 kgv Product Version => 7.5.0
2021-11-22 02:13 kgv Target Version => 7.7.0
2021-11-22 02:13 kgv Summary -fsanitize=undefined error for OCCT 7.6 => Coding Rules, ApproxInt_SvSurfaces - eliminate GCC -fsanitize=undefined error
2021-11-22 02:14 git Note Added: 0105335
2021-11-22 02:14 kgv Note Added: 0105336
2021-11-22 05:37 galbramc Note Added: 0105341
2021-11-30 22:27 galbramc Note Added: 0105548
2021-12-01 10:45 kgv Note Added: 0105554
2021-12-03 16:30 galbramc Note Added: 0105634
2021-12-06 11:47 git Note Added: 0105693
2021-12-06 11:49 kgv Note Added: 0105694
2021-12-06 13:46 kgv Test case number => N/A
2021-12-06 13:46 kgv Note Added: 0105696
2021-12-06 13:46 kgv Assigned To kgv => bugmaster
2021-12-06 13:46 kgv Status new => resolved
2021-12-06 13:46 kgv Status resolved => reviewed
2021-12-07 01:20 galbramc Note Added: 0105710
2021-12-11 11:35 smoskvin Note Added: 0105806
2021-12-11 11:35 smoskvin Status reviewed => tested
2021-12-11 15:14 smoskvin Changeset attached => occt master 9a529829
2021-12-11 15:14 smoskvin Assigned To bugmaster => smoskvin
2021-12-11 15:14 smoskvin Status tested => verified
2021-12-11 15:14 smoskvin Resolution open => fixed
2021-12-11 15:26 git Note Added: 0105818
2023-02-03 05:04 vglukhik Status verified => closed
2023-02-03 05:04 vglukhik Fixed in Version => 7.7.0