Archived issue #0024536

GCC compiler warning on breakage of pointer aliasing rules in BRepFill_Evolved.cxx

Open CASCADEOCCT:Codingclosed4 public notes

Search issues

Description

GCC compiler reports warnings on breakage of C pointer aliasing rules on reference type cast in call to TopoDS::Edge() in BRepFill_Evolved.cxx (see #0024252):

TopoDS_Shape.hxx:54: warning: dereferencing pointer ‘E’ does break strict-aliasing rules
TopoDS_Shape.lxx:90: warning: dereferencing pointer ‘E’ does break strict-aliasing rules
BRepFill_Evolved.cxx:1702: note: initialized from here

The strange point is that this seems to be the only place where such warning is produced, despite of many calls to TopoDS methods in OCCT code. Perhaps the cause is that the type of the local variable initialized by result of call to TopoDS::Edge() is reference.

Public activity

4 archived notes

Participants are labeled by their role within this record.

01Commenter 1
I have pushed branch CR24536 containing possible fix; could you please compile the branch on Linux to see if the warning disappears?
02Commenter 2
Branch CR24536 (and products from GIT master) was compiled on Linux platforms.
[revision removed]

Number of compiler warnings:

occt component :
Linux: 53 (55 on master) - 2 warnings disappear:
TopoDS_Shape.hxx:54, GNU C Compiler 4 (gcc), Priority: Normal
dereferencing pointer ‘E’ does break strict-aliasing rules
TopoDS_Shape.lxx:90, GNU C Compiler 4 (gcc), Priority: Normal
dereferencing pointer ‘E’ does break strict-aliasing rules
Windows: 0 (0 on master)

products component :
Linux: 20 (20 on master)
Windows: 1 (1 on master)
03Commenter 3
Thank you! Please consider it then as reviewed and proceed to testing
04Commenter 2
Dear Commenter 1,

Branch CR24536 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
[revision removed]

Number of compiler warnings:

occt component :
Linux: 53 (55 on master)
Windows: 0 (0 on master)

products component :
Linux: 20 (20 on master)
Windows: 1 (1 on master)

Regressions/Differences:
No regressions/differences

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 326180716 / 325195272
Total CPU difference: 43493.92000000011 / 42240.05999999985

Testing on Windows:
Total MEMORY difference: 377601216 / 377422272
Total CPU difference: 30223.015625 / 31353.0625

There are not differences in images found by testdiff.

Related records