View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0032495 | Community | OCCT:Coding | public | 2021-07-28 05:58 | 2021-09-04 16:28 |
Reporter | galbramc | Assigned To | bugmaster | ||
Priority | normal | Severity | minor | ||
Status | closed | Resolution | fixed | ||
Platform | Mac | OS | OS | ||
Product Version | 6.7.0 | ||||
Target Version | 7.6.0 | Fixed in Version | 7.6.0 | ||
Summary | 0032495: Coding rules - eliminate CLang UndefinedBehaviorSanitizer warnings | ||||
Description | src/NCollection/NCollection_Array1.hxx:405:31: runtime error: applying non-zero offset 8 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/NCollection/NCollection_Array1.hxx:405:31 in src/AdvApp2Var/AdvApp2Var_SysBase.cxx:840:3: runtime error: applying non-zero offset 140341856688136 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/AdvApp2Var/AdvApp2Var_SysBase.cxx:840:3 in src/AdvApp2Var/AdvApp2Var_SysBase.cxx:847:3: runtime error: applying non-zero offset 140341856692704 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/AdvApp2Var/AdvApp2Var_SysBase.cxx:847:3 in src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6488:50: runtime error: applying non-zero offset 140341856688144 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6488:50 in src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6495:62: runtime error: applying non-zero offset 140341856688144 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6495:62 in src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6496:23: runtime error: applying non-zero offset 140341856688400 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6496:23 in src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6511:25: runtime error: applying non-zero offset 140341856688400 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6511:25 in src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6511:39: runtime error: applying non-zero offset 140341856689840 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6511:39 in src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6526:6: runtime error: applying non-zero offset 140341856690128 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6526:6 in src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6526:20: runtime error: applying non-zero offset 140341856692176 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6526:20 in src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6541:22: runtime error: applying non-zero offset 140341856689840 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6541:22 in src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6541:44: runtime error: applying non-zero offset 140341856692176 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6541:44 in src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6551:59: runtime error: applying non-zero offset 140341856692176 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6551:59 in src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6552:20: runtime error: applying non-zero offset 140341856688400 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6552:20 in src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6580:12: runtime error: applying non-zero offset 140341856692176 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6580:12 in src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6581:12: runtime error: applying non-zero offset 140341856688400 to null pointer SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6581:12 in src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6584:40: runtime error: applying non-zero offset 140341856692176 to null pointer | ||||
Steps To Reproduce | Compile on macOS Big Sur with Xcode 12.2 (clang 12.0.5) using the flags -fsanitize=undefined -fno-omit-frame-pointer and run the test suite. | ||||
Tags | No tags attached. | ||||
Test case number | Not required | ||||
|
Branch CR32495 has been created by kgv. SHA-1: d4c5c23c132f4cf329ed23dfb164bd451382d2ba Detailed log of new commits: Author: kgv Date: Wed Jul 28 09:32:34 2021 +0300 0032495: Coding rules - eliminate CLang UndefinedBehaviorSanitizer warnings |
|
Branch CR32495 has been updated forcibly by kgv. SHA-1: 415031c1e41bdd73762ca1d4f04e8e097a4e721f |
|
Branch CR32495 has been updated forcibly by kgv. SHA-1: db51fae183b8dc8dc6f65a469fbf916f2fedbf7b |
|
Branch CR32495 has been updated forcibly by kgv. SHA-1: 0637b663978689c05f02d7322b91c52ef627b6ac |
|
Maria, a draft for AdvApp2Var_SysBase.cxx has been pushed to CR32495. Please try propagating fix to AdvApp2Var_ApproxF2var.cxx (see all uses of variable `wrkar`). It seems these are remnants of weird logic with memory jumps / offsets. AdvApp2Var code is too large to revise the whole logic, so lets just try fix warning. |
|
Analysis |
|
I just realized my initial description was not complete. Here is the complete list of warnings. I can also any fixes if you would like me to. src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6488:50: runtime error: applying non-zero offset 140552806553616 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6495:62: runtime error: applying non-zero offset 140552806553616 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6496:23: runtime error: applying non-zero offset 140552806553872 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6511:25: runtime error: applying non-zero offset 140552806553872 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6511:39: runtime error: applying non-zero offset 140552806555312 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6526:6: runtime error: applying non-zero offset 140552806555600 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6526:20: runtime error: applying non-zero offset 140552806557648 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6541:22: runtime error: applying non-zero offset 140552806555312 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6541:44: runtime error: applying non-zero offset 140552806557648 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6551:59: runtime error: applying non-zero offset 140552806557648 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6552:20: runtime error: applying non-zero offset 140552806553872 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6580:12: runtime error: applying non-zero offset 140552806557648 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6581:12: runtime error: applying non-zero offset 140552806553872 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6584:40: runtime error: applying non-zero offset 140552806557648 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6592:53: runtime error: applying non-zero offset 140552806553872 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6592:67: runtime error: applying non-zero offset 140552806557648 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6599:3: runtime error: applying non-zero offset 140552806557648 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3518:44: runtime error: applying non-zero offset 140552806598160 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3527:39: runtime error: applying non-zero offset 140552806598736 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3527:53: runtime error: applying non-zero offset 140552806598160 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3537:44: runtime error: applying non-zero offset 140552806598448 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3546:39: runtime error: applying non-zero offset 140552806600176 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3546:53: runtime error: applying non-zero offset 140552806598448 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3557:51: runtime error: applying non-zero offset 140552806598736 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3558:3: runtime error: applying non-zero offset 140552806600176 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3558:17: runtime error: applying non-zero offset 140552806598160 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3558:31: runtime error: applying non-zero offset 140552806598448 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3813:63: runtime error: applying non-zero offset 140552806648336 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3817:63: runtime error: applying non-zero offset 140552806650384 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3825:55: runtime error: applying non-zero offset 140552806664336 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3826:55: runtime error: applying non-zero offset 140552806664464 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3834:47: runtime error: applying non-zero offset 140552806648336 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3834:61: runtime error: applying non-zero offset 140552806650384 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3835:9: runtime error: applying non-zero offset 140552806664336 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3835:23: runtime error: applying non-zero offset 140552806664464 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3835:37: runtime error: applying non-zero offset 140552806664592 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3835:51: runtime error: applying non-zero offset 140552806652432 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3835:65: runtime error: applying non-zero offset 140552806658576 to null pointer |
|
galbramc,-fsanitize=undefined -fno-omit-frame-pointer and run the test suit Could you please also comment if you run the whole test suit or some single or a couple of test cases would do the trick? |
|
I'm running my own test suite for his. I'm not sure how to run the OCC test suite... If you can point me to some instructions or tell me how I can try running the OCC test suite. I'm sure that just a couple of tests will do the trick. The call sequence that leads to these warnings is: ShapeConstruct::ConvertSurfaceToBSpline GeomConvert_ApproxSurface::GeomConvert_ApproxSurface AdvApp2Var_ApproxAFunc2Var::AdvApp2Var_ApproxAFunc2Var AdvApp2Var_ApproxAFunc2Var::Perform AdvApp2Var_ApproxAFunc2Var::ComputePatches AdvApp2Var_ApproxAFunc2Var::ComputeConstraints AdvApp2Var_Iso::MakeApprox AdvApp2Var_ApproxF2var::mma2fnc_ |
|
galbramc, how long it takes on your configuration? Could you check the current patch in CR32495 to see if it indeed fixes warnings in AdvApp2Var_SysBase.cxx and NCollection_Array1.hxx? |
|
I only have to run one of my tests to get this error, so it takes seconds. I tested the patch and the patch fixed AdvApp2Var_SysBase.cxx and NCollection_Array1.hxx. |
|
Branch CR32495 has been updated forcibly by mkrylova. SHA-1: cccd2fa57b52239d17564e2da6641da668aa0f5b |
|
Branch CR32495_1 has been created by mkrylova. SHA-1: 978685da4825d2255aab623fc011f6bf16a0a4d4 Detailed log of new commits: Author: kgv Date: Wed Jul 28 09:32:34 2021 +0300 0032495: Coding rules - eliminate CLang UndefinedBehaviorSanitizer warnings - fixed CLang UndefinedBehaviorSanitizer warnings |
|
Branch CR32495_1 has been updated by mkrylova. SHA-1: 7ffd8a46db8ce58bad136f8df4cbc6a198fec4e7 Detailed log of new commits: Author: mkrylova Date: Wed Aug 4 14:24:32 2021 +0300 # fixed initialization |
|
Analysis, Solution Implementation, Testing |
|
Almost all of them got fixed. I still get these three warnings: src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:6433:49: runtime error: applying non-zero offset 140469407445008 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3509:49: runtime error: applying non-zero offset 140469407528976 to null pointer src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx:3801:50: runtime error: applying non-zero offset 140469407567376 to null pointer |
|
Solution implementation |
|
Was there updated code that I should test to fix those last 3 warnings? |
|
Branch CR32495_2 has been created by mkrylova. SHA-1: dd127ccfb2553b1b7131616a2915f2be6af1aeb0 Detailed log of new commits: Author: kgv Date: Wed Jul 28 09:32:34 2021 +0300 0032495: Coding rules - eliminate CLang UndefinedBehaviorSanitizer warnings - fixed CLang UndefinedBehaviorSanitizer warnings |
|
http://jenkins-test-occt.nnov.opencascade.com/view/CR32495_2-master-MKRYLOVA/view/ALL/ |
|
Patch is ready to review: - OCCT: CR32495_2 |
|
I'm still getting the 3 warnings I listed above. All three warnings are related to this new code: wrkar_off = reinterpret_cast<double*> (iofwr + wrkar); |
|
Branch CR32495_3 has been created by kgv. SHA-1: dbd086ed2ff3f355905de430efa6664fdbd40dfe Detailed log of new commits: Author: mkrylova Date: Wed Jul 28 09:32:34 2021 +0300 0032495: Coding rules - eliminate CLang UndefinedBehaviorSanitizer warnings - fixed CLang UndefinedBehaviorSanitizer warnings |
|
Branch CR32495_3 has been updated forcibly by kgv. SHA-1: 059055bb08084eed7629b4f0fd699e8444308b1f |
|
@galbramc, could you check branch CR32495_3? |
|
Sorry for the delay. I wanted to make sure to run our whole test suite. CR32495_3 fixes all the warnings. Thank you for taking care of this! |
|
Please raise the patch - OCCT: branch CR32495_3. |
|
Combination - OCCT branch : IR-2021-09-03 master SHA - f26ee38f2a309ffbf7de4eebbcef2c5a5c57d84e a87b7ddc8cb44606b91e3f37113847c3f5f50fdc Products branch : IR-2021-09-03 SHA - 87cca1a8f3dd94387a936b9d49f5bd719c69cf4d 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: 17495.94000000042 / 17441.55000000031 [+0.31%] Products Total CPU difference: 11565.440000000113 / 11534.270000000102 [+0.27%] Windows-64-VC14: OCCT Total CPU difference: 19307.140625 / 19200.421875 [+0.56%] Products Total CPU difference: 12917.859375 / 12874.53125 [+0.34%] Image differences : No differences that require special attention Memory differences : No differences that require special attention |
|
Branch CR32495 has been deleted by mnt. SHA-1: cccd2fa57b52239d17564e2da6641da668aa0f5b |
|
Branch CR32495_1 has been deleted by mnt. SHA-1: 7ffd8a46db8ce58bad136f8df4cbc6a198fec4e7 |
|
Branch CR32495_2 has been deleted by mnt. SHA-1: dd127ccfb2553b1b7131616a2915f2be6af1aeb0 |
|
Branch CR32495_3 has been deleted by mnt. SHA-1: 059055bb08084eed7629b4f0fd699e8444308b1f |
occt: master 3016a390 2021-07-28 06:32:34
Committer: bugmaster Details Diff |
0032495: Coding rules - eliminate CLang UndefinedBehaviorSanitizer warnings - fixed CLang UndefinedBehaviorSanitizer warnings |
Affected Issues 0032495 |
|
mod - src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx | Diff File | ||
mod - src/AdvApp2Var/AdvApp2Var_SysBase.cxx | Diff File | ||
mod - src/NCollection/NCollection_Array1.hxx | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2021-07-28 05:58 | galbramc | New Issue | |
2021-07-28 05:58 | galbramc | Assigned To | => kgv |
2021-07-28 09:26 | kgv | Product Version | 7.5.1 => 7.5.0 |
2021-07-28 09:26 | kgv | Target Version | => 7.6.0 |
2021-07-28 09:26 | kgv | Summary | Xcode 12.2 UndefinedBehaviorSanitizer reports new warnings => Coding rules - eliminate CLang UndefinedBehaviorSanitizer warnings |
2021-07-28 09:26 | kgv | Description Updated | |
2021-07-28 09:27 | kgv | Description Updated | |
2021-07-28 09:35 | git | Note Added: 0102843 | |
2021-07-28 09:38 | kgv | Relationship added | child of 0023952 |
2021-07-28 09:38 | kgv | Product Version | 7.5.0 => 6.7.0 |
2021-07-28 10:37 | git | Note Added: 0102844 | |
2021-07-28 11:20 | git | Note Added: 0102845 | |
2021-07-28 11:21 | git | Note Added: 0102846 | |
2021-07-28 12:30 | kgv | Note Added: 0102848 | |
2021-07-28 12:30 | kgv | Assigned To | kgv => mkrylova |
2021-07-28 12:30 | kgv | Status | new => assigned |
2021-07-28 12:31 | kgv | Note Edited: 0102848 | |
2021-07-30 12:03 |
|
Note Added: 0102886 | |
2021-07-30 16:05 | galbramc | Note Added: 0102892 | |
2021-07-30 16:09 | kgv | Note Added: 0102893 | |
2021-07-30 16:19 | galbramc | Note Added: 0102894 | |
2021-07-30 16:27 | kgv | Note Added: 0102895 | |
2021-07-30 16:31 | galbramc | Note Added: 0102896 | |
2021-07-30 18:21 |
|
Note Edited: 0102886 | |
2021-08-04 12:23 | git | Note Added: 0102972 | |
2021-08-04 12:26 | git | Note Added: 0102973 | |
2021-08-04 14:25 | git | Note Added: 0102977 | |
2021-08-04 17:08 |
|
Note Added: 0102980 | |
2021-08-04 18:02 | galbramc | Note Added: 0102985 | |
2021-08-04 18:02 | galbramc | Note Edited: 0102985 | |
2021-08-06 16:05 |
|
Note Added: 0103035 | |
2021-08-17 00:04 | galbramc | Note Added: 0103247 | |
2021-09-01 15:40 | git | Note Added: 0103632 | |
2021-09-01 21:33 |
|
Note Added: 0103649 | |
2021-09-01 21:34 |
|
Note Added: 0103650 | |
2021-09-01 21:34 |
|
Assigned To | mkrylova => kgv |
2021-09-01 21:34 |
|
Status | assigned => resolved |
2021-09-01 22:42 | galbramc | Note Added: 0103651 | |
2021-09-02 00:01 | git | Note Added: 0103654 | |
2021-09-02 10:17 | git | Note Added: 0103660 | |
2021-09-02 13:38 | kgv | Note Added: 0103672 | |
2021-09-02 13:38 | kgv | Assigned To | kgv => galbramc |
2021-09-02 13:38 | kgv | Status | resolved => feedback |
2021-09-03 16:49 | galbramc | Note Added: 0103730 | |
2021-09-03 16:56 | kgv | Note Added: 0103731 | |
2021-09-03 16:56 | kgv | Assigned To | galbramc => bugmaster |
2021-09-03 16:56 | kgv | Status | feedback => reviewed |
2021-09-03 17:19 |
|
Note Edited: 0103650 | |
2021-09-04 14:27 |
|
Note Added: 0103764 | |
2021-09-04 14:27 |
|
Status | reviewed => tested |
2021-09-04 14:36 | bugmaster | Changeset attached | => occt master 3016a390 |
2021-09-04 14:36 | bugmaster | Status | tested => verified |
2021-09-04 14:36 | bugmaster | Resolution | open => fixed |
2021-09-04 14:59 | git | Note Added: 0103794 | |
2021-09-04 15:00 | git | Note Added: 0103795 | |
2021-09-04 15:00 | git | Note Added: 0103796 | |
2021-09-04 15:00 | git | Note Added: 0103797 | |
2021-09-04 16:28 |
|
Test case number | => Not required |