[Bug c++/72659] New: Attribute may_alias breaks type matching

andysem at mail dot ru gcc-bugzilla@gcc.gnu.org
Tue Jul 26 16:05:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72659

            Bug ID: 72659
           Summary: Attribute may_alias breaks type matching
           Product: gcc
           Version: 5.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andysem at mail dot ru
  Target Milestone: ---

Created attachment 39021
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39021&action=edit
Preprocessed code that fails to compile

The attached preprocessed code (compressed due to size limit) fails to compile
with the following error:

/home/lastique/src/xcoder/trunk/src/media/workers/mosaic/mosaicimplI.cpp:11:7:
error: ‘void MosaicImpl_i::scaler::scale(uint32_t, uint32_t, const
const_byte_range&, const image_yuv420p&)’ marked ‘override’, but does not
override
  void scale(std::uint32_t in_width, std::uint32_t in_height,
xcoder::ipc::const_byte_range const& in_payload, xcoder::imagine::image_yuv420p
const& out_subframe) override
       ^

The command line is as follows:

/usr/bin/c++   -DBOOST_ALL_DYN_LINK=1 -DBOOST_CB_DISABLE_DEBUG
-DBOOST_RESULT_OF_USE_DECLTYPE -D_GNU_SOURCE=1 -D_REENTRANT=1
-D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
-I/home/lastique/xcoder-usr/include -I/home/lastique/src/boost-xcoder
-I/home/lastique/src/xcoder/trunk/src/common
-I/home/lastique/src/xcoder/trunk/tmp2/src/common
-I/home/lastique/src/xcoder/trunk/src/media
-I/home/lastique/src/xcoder/trunk/src/media/common  -Wall
-Wno-unused-local-typedefs -Wno-maybe-uninitialized -include utils/global.h
-march=nocona -mtune=corei7-avx -msse -msse2 -msse3 -std=gnu++14 -fPIC
-fvisibility=hidden -fvisibility-inlines-hidden
-fdebug-prefix-map=/home/lastique/src/xcoder/trunk/=
-Wa,--compress-debug-sections -g -D_DEBUG -O0 -g3 -fno-omit-frame-pointer   -o
CMakeFiles/mosaic.dir/mosaicimplI.cpp.o -c
/home/lastique/src/xcoder/trunk/src/media/workers/mosaic/mosaicimplI.cpp

The function in question clearly does override scaler_base::scale and the code
compiles if, for example:
- The "__attribute__ ((__may_alias__))" is removed from the image struct
declaration or,
- The MosaicImpl_i::m_out_image member is removed.

The attached preprocessed code is a reduced sample, and the original code
exhibits this problem only when building in debug mode (with the command line
like the above) but not when building in release. The full code base shows
multiple failures at different places, like inability to assign address of a
function template involving colorspaces (the first template argument for image)
to a variable; all errors disappear when "__attribute__ ((__may_alias__))" is
removed from image.

GCC version:

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
5.4.0-6ubuntu1~16.04.1' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs
--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-5 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib
--disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.1)

The same problem also appears with 4.7.2:

Using built-in specs.
COLLECT_GCC=/usr/bin/g++-4.7.real
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5'
--with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs
--enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.7 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-5)


More information about the Gcc-bugs mailing list