Bug #57

CollisionMap indirectly relies on undefined behaviour (warning -Waggressive-loop-optimizations in GMTL 0.6.1)

Added by Johannes Zarl-Zierl about 5 years ago.

Status:NewStart date:04/21/2015
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:-
Resolution:

Description

Compiling with a gcc 4.9.1, the following compilation warning is issued:

[ 58%] Building CXX object tools/libraries/CollisionMap/CMakeFiles/inVRsCollisionMapBase.dir/CollisionLineSet.cpp.o
In file included from /home/edvz/zing/scratch/inVRs_OSG/external/gmtl-0.6.1/gmtl/Xforms.h:12:0,
                 from /home/edvz/zing/scratch/inVRs_OSG/external/gmtl-0.6.1/gmtl/Generate.h:21,
                 from /home/edvz/zing/scratch/inVRs_OSG/src/inVRs/SystemCore/DataTypes.h:42,
                 from /home/edvz/zing/scratch/inVRs_OSG/tools/libraries/CollisionMap/CollisionObject.h:42,
                 from /home/edvz/zing/scratch/inVRs_OSG/tools/libraries/CollisionMap/CollisionLineSet.h:41,
                 from /home/edvz/zing/scratch/inVRs_OSG/tools/libraries/CollisionMap/CollisionLineSet.cpp:28:
/home/edvz/zing/scratch/inVRs_OSG/external/gmtl-0.6.1/gmtl/MatrixOps.h: In function ‘gmtl::Matrix<DATA_TYPE, ROWS, COLS>& gmtl::invertAffine(gmtl::Matrix<DATA_TYPE, ROWS, COLS>&, const gmtl::Matrix<DATA_TYPE, ROWS, COLS>&) [with DATA_TYPE = float; unsigned int ROWS = 2u; unsigned int COLS = 2u]’:
/home/edvz/zing/scratch/inVRs_OSG/external/gmtl-0.6.1/gmtl/MatrixOps.h:335:10: warning: iteration 2u invokes undefined behavior [-Waggressive-loop-optimizations]
          result[x][y] = src[y][x];
          ^
/home/edvz/zing/scratch/inVRs_OSG/external/gmtl-0.6.1/gmtl/MatrixOps.h:333:7: note: containing loop
       for (int y = 0; y < 3; ++y)
       ^
/home/edvz/zing/scratch/inVRs_OSG/external/gmtl-0.6.1/gmtl/MatrixOps.h: In member function ‘std::vector<CollisionData*>& CollisionLineSet::checkCollisionWithLineSet(CollisionLineSet*, std::vector<CollisionData*>&, bool)’:
/home/edvz/zing/scratch/inVRs_OSG/external/gmtl-0.6.1/gmtl/MatrixOps.h:335:10: warning: iteration 2u invokes undefined behavior [-Waggressive-loop-optimizations]
          result[x][y] = src[y][x];
          ^
/home/edvz/zing/scratch/inVRs_OSG/external/gmtl-0.6.1/gmtl/MatrixOps.h:332:7: note: containing loop
       for (int x = 0; x < 3; ++x)
       ^

Also available in: Atom PDF