Browse Source

GCC 4.4: disabling strict-aliasing altogether.

It seriously breaks RectangularMatrix::from() and related functions in
subclasses and I don't have better solution for that yet. Hope newer
GCCs fix this issue, because compiling with this option is a way to
unoptimized hell.

The breakage can be seen when Physics::AxisAlignedBox::applyTransformation()
is called in loop from Physics::ObjectShapeGroup::setClean() (e.g.
three AABBs in the group). Result is that the transformation doesn't get
applied at all.

I tried also these solutions without success:

 * Reimplementing from() to return (const) copy, so it doesn't alias
   original type (warnings suddenly disappear, but the problem persists).
 * Using __attribute__((__may_alias__)) on RectangularMatrix - doesn't
   help at all (even the warnings remain).
 * Using __attribute__((__may_alias__)) on all vector/matrix classes -
   causes compilation failure (non-matching function declarations and
   definitions due to vector/matrix parameters). Also tried to add it to
   all forward-declarations and typedefs, but it causes only a few more
   warnings about ignored attribute.
Vladimír Vondruš 14 years ago
parent
commit
dbd14b9e5b
  1. 6
      src/CMakeLists.txt

6
src/CMakeLists.txt

@ -1,5 +1,11 @@
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wold-style-cast -Winit-self -pedantic -std=c++0x -fvisibility=hidden")
# Disable strict aliasing for GCC 4.4, as it breaks RectangularMatrix::from()
# (and I have no better solution for that yet)
if(CORRADE_GCC44_COMPATIBILITY)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing")
endif()
# -Wdouble-promotion is supported from GCC 4.6
# TODO: do this with check_c_compiler_flags()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND NOT "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.6.0")

Loading…
Cancel
Save