Archived issue #0024875

Coding rules - eliminate GCC warning -Wstrict-aliasing in TKOpenGl

Open CASCADEOCCT:Codingclosed8 public notes

Search issues

Description

GCC reports the following warnings:
../../../../inc/NCollection_Vec3.hxx: In member function ‘virtual void OpenGl_Flipper::Render(const Handle_OpenGl_Workspace&) const’:
../../../../inc/NCollection_Vec3.hxx:90: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
../../../../inc/NCollection_Vec3.hxx:96: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
../../../../inc/NCollection_Vec3.hxx:102: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
../../../../src/OpenGl/OpenGl_Flipper.cxx:155: note: initialized from here
../../../../inc/NCollection_Vec3.hxx:90: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
../../../../inc/NCollection_Vec3.hxx:96: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
../../../../inc/NCollection_Vec3.hxx:102: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
../../../../src/OpenGl/OpenGl_Flipper.cxx:156: note: initialized from here
../../../../inc/NCollection_Vec3.hxx:90: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
../../../../inc/NCollection_Vec3.hxx:96: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
../../../../inc/NCollection_Vec3.hxx:102: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
../../../../src/OpenGl/OpenGl_Flipper.cxx:161: note: initialized from here
../../../../inc/NCollection_Vec3.hxx:90: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
../../../../inc/NCollection_Vec3.hxx:96: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
../../../../inc/NCollection_Vec3.hxx:102: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
../../../../src/OpenGl/OpenGl_Flipper.cxx:162: note: initialized from here
../../../../inc/NCollection_Vec3.hxx:90: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
../../../../inc/NCollection_Vec3.hxx:96: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
../../../../inc/NCollection_Vec3.hxx:102: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
../../../../src/OpenGl/OpenGl_Flipper.cxx:167: note: initialized from here
../../../../inc/NCollection_Vec3.hxx:90: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
../../../../inc/NCollection_Vec3.hxx:96: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
../../../../inc/NCollection_Vec3.hxx:102: warning: dereferencing pointer ‘<anonymous>’ does break strict-aliasing rules
../../../../src/OpenGl/OpenGl_Flipper.cxx:168: note: initialized from here


gcc 4.9.2 reports only the following warning:
OpenGl_SceneGeometry.cxx:172, GNU C Compiler 4 (gcc), Priority: Normal
dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]

Steps to reproduce

N/A

Public activity

8 archived notes

Participants are labeled by their role within this record.

01Commenter 2
These warnings are not generated on current master using gcc4.9.2 within -O2, -O3, -Wall and even -Wextra options and do not present in log #0026236.
02Commenter 2
Dear Commenter 1,

please close the issue as non-reproducible.
03Commenter 3
Branch [archived branch] has been created by Commenter 2.

[revision removed]


Detailed log of new commits:

Author: Commenter 2
Date: Fri Oct 16 09:39:00 2015 +0300

    0024875: Coding rules - eliminate GCC warning -Wstrict-aliasing in TKOpenGl
04Commenter 2
Please check compilation of the patch in branch CR24875.
05Commenter 3
Branch [archived branch] has been updated forcibly by Participant.

[revision removed]
06Commenter 6
Branch [archived branch] has been rebased on the current master
07Commenter 7
Dear Commenter 1,

Branch CR24875 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested.
[revision removed]

Number of compiler warnings:
occt component:
   Linux: 7 (8 on master)
   Windows: 0 (0 on master)
products component:
   Linux: 39 (39 on master)
   Windows: 0 (0 on master)

Regressions/Differences:
Not detected

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 92092164 / 92273976 [-0.20%]
Total CPU difference: 19655.599999999806 / 19657.97999999973 [-0.01%]

Testing on Windows:
Total MEMORY difference: 58068568 / 58086183 [-0.03%]
Total CPU difference: 18695.39384149913 / 18302.583323498948 [+2.15%]
08Commenter 3
Branch [archived branch] has been deleted by Commenter 2.

[revision removed]

Related records