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

            Bug ID: 66279
           Summary: Input/output asm operand is not loaded inside a
                    constructor with a virtual base class
           Product: gcc
           Version: 5.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andrey.vihrov at gmail dot com
  Target Milestone: ---

Created attachment 35620
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35620&action=edit
Testcase

When inline assembly is used inside a constructor of a class with a virtual
base class, and the inline assembly block has an input/output operand, GCC
fails to load the value of the operand into a corresponding register.

The attached code, compiled with GCC 5.1, produces

a.out: test.cpp:16: B::B(): Assertion `x == 42' failed.

This happens with both -O2 and -O0. Remove 'virtual' or place the code in a
regular function, and the assertion will succeed. Marking the ctor as inline
also makes the assertion succeed.

gcc -v:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/5.1.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/gcc-multilib/src/gcc-5-20150519/configure --prefix=/usr
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --enable-libmpx --with-system-zlib --with-isl
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu
--disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object
--enable-linker-build-id --enable-lto --enable-plugin
--enable-install-libiberty --with-linker-hash-style=gnu
--enable-gnu-indirect-function --enable-multilib --disable-werror
--enable-checking=release --with-default-libstdcxx-abi=c++98
Thread model: posix
gcc version 5.1.0 (GCC)

Reply via email to