Skip to content

Commit

Permalink
configure: enable -fno-strict-aliasing option
Browse files Browse the repository at this point in the history
Enable the -fno-strict-aliasing compiler option. Some sections of code
in ODP deliberately access the same data via pointers to different
types, which is undefined behavior in C. The -fno-strict-aliasing
option prevents the compiler from making assumptions about aliasing in
these instances.

Signed-off-by: Jere Leppänen <[email protected]>
Reviewed-by: Janne Peltonen <[email protected]>
  • Loading branch information
JereLeppanen authored and MatiasElo committed Aug 26, 2024
1 parent 3478bbc commit de4066f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ How to build:
See DEPENDENCIES file about system requirements and dependencies to external
libraries/packages. It contains also some more detailed build instructions.

ODP requires the -fno-strict-aliasing (or equivalent) compiler option. This
option is enabled by default in ODP.

Generally, ODP and test applications are built with these three steps:
./bootstrap
./configure
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ AS_IF([test "$GCC" == yes],
)
)

ODP_CFLAGS="$ODP_CFLAGS -std=c11"
ODP_CXXFLAGS="$ODP_CXXFLAGS -std=c++11"
ODP_CFLAGS="$ODP_CFLAGS -std=c11 -fno-strict-aliasing"
ODP_CXXFLAGS="$ODP_CXXFLAGS -std=c++11 -fno-strict-aliasing"

# Extra flags for example to suppress certain warning types
ODP_CFLAGS="$ODP_CFLAGS $ODP_CFLAGS_EXTRA"
Expand Down

0 comments on commit de4066f

Please sign in to comment.