[Mesa-dev] [PATCH] configure.ac/swr: build swr with -fno-strict-aliasing

Rowley, Timothy O timothy.o.rowley at intel.com
Tue Aug 2 18:14:28 UTC 2016


> On Aug 2, 2016, at 1:00 PM, Matt Turner <mattst88 at gmail.com> wrote:
> 
> On Tue, Aug 2, 2016 at 10:53 AM, Tim Rowley <timothy.o.rowley at intel.com> wrote:
>> swr rasterizer contains numerous data transfers between vectors
>> and ordinary C types.  Fixing for strict aliasing will take time.
> 
> Oh, sorry! I forgot about swr.
> 
>> ---
>> configure.ac                        | 7 +++++++
>> src/gallium/drivers/swr/Makefile.am | 1 +
>> 2 files changed, 8 insertions(+)
>> 
>> diff --git a/configure.ac b/configure.ac
>> index aea5890..fb4a12a 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -312,6 +312,8 @@ if test "x$GCC" = xyes; then
>>     MSVC2013_COMPAT_CFLAGS="-Werror=pointer-arith"
>>     MSVC2013_COMPAT_CXXFLAGS="-Werror=pointer-arith"
>> 
>> +    NO_STRICT_ALIASING_CFLAGS="-fno-strict-aliasing"
>> +
>>     # Enable -Werror=vla if compiler supports it
>>     save_CFLAGS="$CFLAGS"
>>     AC_MSG_CHECKING([whether $CC supports -Werror=vla])
>> @@ -341,11 +343,16 @@ if test "x$GXX" = xyes; then
>> 
>>     # We don't want floating-point math functions to set errno or trap
>>     CXXFLAGS="$CXXFLAGS -fno-math-errno -fno-trapping-math"
>> +
>> +    NO_STRICT_ALIASING_CXXFLAGS="-fno-strict-aliasing"
>> fi
>> 
>> AC_SUBST([MSVC2013_COMPAT_CFLAGS])
>> AC_SUBST([MSVC2013_COMPAT_CXXFLAGS])
>> 
>> +AC_SUBST([NO_STRICT_ALIASING_CFLAGS])
>> +AC_SUBST([NO_STRICT_ALIASING_CXXFLAGS])
>> +
>> dnl even if the compiler appears to support it, using visibility attributes isn't
>> dnl going to do anything useful currently on cygwin apart from emit lots of warnings
>> case "$host_os" in
>> diff --git a/src/gallium/drivers/swr/Makefile.am b/src/gallium/drivers/swr/Makefile.am
>> index 3459af3..fa02349 100644
>> --- a/src/gallium/drivers/swr/Makefile.am
>> +++ b/src/gallium/drivers/swr/Makefile.am
>> @@ -29,6 +29,7 @@ noinst_LTLIBRARIES = libmesaswr.la
>> libmesaswr_la_SOURCES = $(LOADER_SOURCES)
>> 
>> COMMON_CXXFLAGS = \
>> +       $(NO_STRICT_ALIASING_CXXFLAGS) \
> 
> I think you should just put -fno-strict-aliasing here instead. I don't
> think the variable and substitutions in configure.ac add anything.

My thinking behind using substitution was to handle non-gcc compilers, though both icc and clang seem to pass configure.ac’s gcc check and silently accept -fno-strict-aliasing.  I’ll send another patch with just the swr makefile change.

-Tim



More information about the mesa-dev mailing list