View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0028431 | Open CASCADE | OCCT:Coding | public | 2017-02-03 13:07 | 2017-09-29 16:24 |
Reporter | Assigned To | apn | |||
Priority | normal | Severity | minor | ||
Status | closed | Resolution | fixed | ||
Product Version | 7.2.0 | ||||
Target Version | 7.2.0 | Fixed in Version | 7.2.0 | ||
Summary | 0028431: Coding, Graphic3d - Eliminate GCC warning -Wstrict-overflow | ||||
Description | Warning -Wstrict-overflow appears in file occt/src/Graphic3d/Graphic3d_ArrayOfPrimitives.cxx. Assuming signed overflow does not occur when assuming that (X + c) >= X is always true [-Wstrict-overflow] Graphic3d_ArrayOfPrimitives.cxx:165 Graphic3d_ArrayOfPrimitives.cxx:195 Graphic3d_ArrayOfPrimitives.cxx:227 Graphic3d_ArrayOfPrimitives.cxx:241 Reproduced only on next platforms: • Fedora22-64 (gcc 5.3.1) • Ubuntu-1604-64 (gcc 5.4.0) | ||||
Steps To Reproduce | Build with GCC 5.2 | ||||
Tags | No tags attached. | ||||
Test case number | Not needed | ||||
|
Branch CR28431 has been created by abv. SHA-1: d6d34b217ccce74afdc3ff57a340f7d0d7e01294 Detailed log of new commits: Author: abv Date: Sun Feb 5 11:59:29 2017 +0300 0028431: Coding, Graphic3d - Eliminate GCC warning -Wstrict-overflow Code amended to avoid warning issued by GCC optimizer |
|
Apparently the reason of the warning is specific combination of operations with counter: - In Graphic3d_ArrayOfPrimitives::AddVertex(): > const Standard_Integer anIndex = myAttribs->NbElements + 1; > SetVertice (anIndex, theX, theY, theZ); - Then, in inline Graphic3d_ArrayOfPrimitives::SetVertice() > myAttribs->NbElements = Max (theIndex, myAttribs->NbElements); Here GCC apparently is able to detect that theIndex is myAttribs->NbElements+1, and assume that no integer overflow occurs and thus theIndex is always greater than myAttribs->NbElements. The warning just says "hey, I assume that no overflow occurs and optimize the code such that it can work differently than what literally coded (in case of overflow)". Replacing use of "Max" by "if" seems to fix the issue. Fix pushed to CR28431, please review. |
|
Please test the patch. |
|
Dear BugMaster, Branch CR28431 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested. SHA-1: d6d34b217ccce74afdc3ff57a340f7d0d7e01294 Number of compiler warnings: occt component: Linux: 0 (0 on master) Windows: 0 (0 on master) MasOS: 0 (0 on master) Fedora22-64: 0 Ubuntu-1604-64: 0 products component: Linux: 64 Windows: 0 MacOS: 1201 Regressions/Differences: Not detected Testing cases: Not needed Testing on Linux: Total MEMORY difference: 92039342 / 91275124 [+0.84%] Total CPU difference: 19690.200000000386 / 19662.570000000327 [+0.14%] Testing on Windows: Total MEMORY difference: 57123763 / 57124391 [-0.00%] Total CPU difference: 18044.05846629865 / 18512.045866198645 [-2.53%] |
|
Branch CR28431 has been deleted by inv. SHA-1: d6d34b217ccce74afdc3ff57a340f7d0d7e01294 |
Date Modified | Username | Field | Change |
---|---|---|---|
2017-02-03 13:07 |
|
New Issue | |
2017-02-03 13:07 |
|
Assigned To | => abv |
2017-02-03 13:18 |
|
Relationship added | related to 0026937 |
2017-02-05 11:59 | git | Note Added: 0063447 | |
2017-02-06 10:42 |
|
Note Added: 0063454 | |
2017-02-06 10:42 |
|
Assigned To | abv => kgv |
2017-02-06 10:42 |
|
Status | new => resolved |
2017-02-06 10:42 |
|
Steps to Reproduce Updated | |
2017-02-06 10:47 | kgv | Note Added: 0063455 | |
2017-02-06 10:47 | kgv | Assigned To | kgv => bugmaster |
2017-02-06 10:47 | kgv | Status | resolved => reviewed |
2017-02-06 10:47 | kgv | Product Version | => 7.2.0 |
2017-02-06 16:57 | apn | Test case number | => Not needed |
2017-02-06 16:57 | apn | Assigned To | bugmaster => apn |
2017-02-09 14:26 | apn | Note Added: 0063734 | |
2017-02-09 14:27 | apn | Note Edited: 0063734 | |
2017-02-09 14:28 | apn | Assigned To | apn => bugmaster |
2017-02-09 14:28 | apn | Status | reviewed => tested |
2017-02-10 14:33 | apn | Changeset attached | => occt master f87817bc |
2017-02-10 14:33 | apn | Assigned To | bugmaster => apn |
2017-02-10 14:33 | apn | Status | tested => verified |
2017-02-10 14:33 | apn | Resolution | open => fixed |
2017-03-20 14:35 | git | Note Added: 0064503 | |
2017-09-29 16:20 |
|
Fixed in Version | => 7.2.0 |
2017-09-29 16:24 |
|
Status | verified => closed |