From d51b89a554bf138d5ded5e9e7e323af0ec5b895f Mon Sep 17 00:00:00 2001 From: apl Date: Thu, 26 Jan 2017 12:54:30 +0300 Subject: [PATCH] 0028361: Visualization, TKV3d - buggy behavior of Transformation Persistence compiled on several Linux platforms in optimized mode The patch fixes transformation persistence for various set of GCC compilers. 1) Optimized template-specialized operator /= for division (causes bugs) of NCollection_Vec4 was replaced with non-specialized version. 2) NCollection_Vec4::xyz() is not used since compiler uses modifiable-reference returning version, which invokes warning of possible strict-aliasing rules violation and leads to incorrect behavior of the reference. --- src/Graphic3d/Graphic3d_TransformPers.hxx | 4 ++-- tests/bugs/vis/bug28361 | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 tests/bugs/vis/bug28361 diff --git a/src/Graphic3d/Graphic3d_TransformPers.hxx b/src/Graphic3d/Graphic3d_TransformPers.hxx index 0588c7c8a9..4f3ba60e8b 100644 --- a/src/Graphic3d/Graphic3d_TransformPers.hxx +++ b/src/Graphic3d/Graphic3d_TransformPers.hxx @@ -510,8 +510,8 @@ void Graphic3d_TransformPers::Apply (const Handle(Graphic3d_Camera)& theCamera, { typename BVH_Box::BVH_VecNt& aCorner = anArrayOfCorners[anIt]; aCorner = aTPers * aCorner; - aCorner /= aCorner.w(); - theBoundingBox.Add (aCorner.xyz()); + aCorner = aCorner / aCorner.w(); + theBoundingBox.Add (typename BVH_Box::BVH_VecNt (aCorner.x(), aCorner.y(), aCorner.z())); } } diff --git a/tests/bugs/vis/bug28361 b/tests/bugs/vis/bug28361 new file mode 100644 index 0000000000..c4c24659c3 --- /dev/null +++ b/tests/bugs/vis/bug28361 @@ -0,0 +1,14 @@ +puts "============" +puts "OCC28361 Visualization, TKV3d - buggy behavior of Transformation Persistence compiled on several Linux platforms in optimized mode" +puts "============" +puts "" + +vclear +vinit View1 +pload MODELING VISUALIZATION +box b 10 10 10 +vdisplay b -trsfPers zoomRotate -trsfPersPos 90 90 90 +vmoveto 266 164 +if { [vreadpixel 256 174 rgb name] != "CYAN1" } { puts "Error: the box is not highlighted" } + +vdump $imagedir/${casename}.png