MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0029164Open CASCADE[OCCT] OCCT:Codingpublic2017-09-29 18:172018-06-29 21:19
Reporterabv 
Assigned Tobugmaster 
PrioritynormalSeverityminor 
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target Version[OCCT] 7.3.0Fixed in Version[OCCT] 7.3.0 
Summary0029164: GCC 7.1 compiler warnings -Wmaybe-uninitialized on gp_XYZ and siblings
DescriptionWhen OCCT is built with GCC 7.1 compiler (MinGw-64) it reports several warnings -Wmaybe-uninitialized in gp_XYZ and sibling classes.

While location of the problem is not properly reported by compiler, the reason is recognized: this is due to usage of local variables of reference type pointing to field of temporray object, like this:

Handle(Geom_Line) aLine = ...;
const gp_Dir& aDir = aLine->Lin().Direction();

Here Geom_Line::Lin() returns temporary object, and Direction() returns reference to its field. The object gets destroyed immediately (compiler has no knowledge of the fact that the value returned by Direction() is reference to field of that object). Thus aDir points to memory where destroyed object was located and which can be easily corrupted.
Steps To ReproduceBuild with GCC 7.1 (MinGW-64)
TagsNo tags attached.
Test case numberNot required
Attached Files

- Relationships

-  Notes
(0071073)
git (administrator)
2017-09-29 18:35

Branch CR29164 has been created by abv.

SHA-1: 882dbc8cb1d8bbe1841467097457c9e243423c5f


Detailed log of new commits:

Author: abv
Date: Fri Sep 29 18:35:03 2017 +0300

    0029164: GCC 7.1 compiler warnings -Wmaybe-uninitialized in gp_XYZ and siblings
    
    Code is corrected to avoid local variables of reference type pointing to fields of temporary objects.

Author: kgv
Date: Thu Sep 28 21:29:22 2017 +0300

    0029152: Coding Rules - eliminate GCC compiler warnings -Wmisleading-indentation when using MinGW
(0071074)
git (administrator)
2017-09-29 18:56

Branch CR29164 has been updated forcibly by abv.

SHA-1: e8701df9e5b08da1fa0eb02b939b976422ecba99
(0071076)
git (administrator)
2017-09-29 19:09

Branch CR29164 has been updated forcibly by abv.

SHA-1: 72886751fde0a0aae0f1117a24d75d165ff369a2
(0071079)
git (administrator)
2017-09-29 20:19

Branch CR29164 has been updated forcibly by abv.

SHA-1: 4e05f0aade0786ae27b8810747398b6015b60d0c
(0071093)
abv (manager)
2017-10-01 14:09

Fix is pushed to CR29164, please review
(0071095)
kgv (developer)
2017-10-01 16:23

Please test the patch.
(0071134)
bugmaster (administrator)
2017-10-03 09:40

Tested in framework of testing issue 29170
(0071473)
git (administrator)
2017-10-14 12:20

Branch CR29164 has been deleted by kgv.

SHA-1: 4e05f0aade0786ae27b8810747398b6015b60d0c

- Related Changesets
occt: master 9b372aa8
Timestamp: 2017-09-29 15:35:03
Author: abv
Committer: bugmaster
Details ] Diff ]
0029164: GCC 7.1 compiler warnings -Wmaybe-uninitialized in gp_XYZ and siblings

Code is corrected to avoid local variables of reference type pointing to fields of temporary objects.
mod - src/AIS/AIS_EqualDistanceRelation.cxx Diff ] File ]
mod - src/BRepClass3d/BRepClass3d_SClassifier.cxx Diff ] File ]
mod - src/DrawDim/DrawDim_Distance.cxx Diff ] File ]
mod - src/TopOpeBRepTool/TopOpeBRepTool_GEOMETRY.cxx Diff ] File ]
mod - src/TopOpeBRepTool/TopOpeBRepTool_TOOL.cxx Diff ] File ]

- Issue History
Date Modified Username Field Change
2017-09-29 18:17 abv New Issue
2017-09-29 18:17 abv Assigned To => kgv
2017-09-29 18:36 git Note Added: 0071073
2017-09-29 18:56 git Note Added: 0071074
2017-09-29 19:09 git Note Added: 0071076
2017-09-29 20:19 git Note Added: 0071079
2017-10-01 14:09 abv Note Added: 0071093
2017-10-01 14:09 abv Steps to Reproduce Updated View Revisions
2017-10-01 14:24 abv Status new => resolved
2017-10-01 16:23 kgv Note Added: 0071095
2017-10-01 16:23 kgv Assigned To kgv => bugmaster
2017-10-01 16:23 kgv Status resolved => reviewed
2017-10-03 09:40 bugmaster Note Added: 0071134
2017-10-03 09:40 bugmaster Status reviewed => tested
2017-10-03 09:52 bugmaster Test case number => Not required
2017-10-06 14:55 bugmaster Changeset attached => occt master 9b372aa8
2017-10-06 14:55 bugmaster Status tested => verified
2017-10-06 14:55 bugmaster Resolution open => fixed
2017-10-14 12:20 git Note Added: 0071473
2018-06-29 21:15 user533 Fixed in Version => 7.3.0
2018-06-29 21:19 user533 Status verified => closed


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker