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

            Bug ID: 93998
           Summary: ICE in adjust_temp_type, at cp/constexpr.c:1426
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ostash at ostash dot kiev.ua
  Target Milestone: ---

Hello,

Following code 
----
#define LIKELY(x) __builtin_expect(!!(x), 1)

class Code
{
public:
  constexpr bool operator==(Code rhs) const noexcept { return value_ ==
rhs.value_; }

private:
  int value_;
};

int func(const Code a, const Code b, bool cond)
{
  return LIKELY(a == b || cond) ? 0 : 1;
}
----

causes an ICE with GCC:
----
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/prefix/libexec/gcc/x86_64-pc-linux-gnu/10.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-10-20200223/configure --disable-multiarch
--disable-libquadmath --disable-libquadmath-support --disable-libssp
--disable-libstdcxx-pch --disable-multilib --disable-nls
--enable-checking=release --enable-__cxa_atexit --enable-languages=c,c++
--enable-libstdcxx-debug --enable-lto --enable-plugin --enable-threads=posix
--enable-tls --with-build-config=bootstrap-lto
--with-default-libstdcxx-abi=gcc4-compatible --with-linker-hash-style=gnu
--with-system-zlib --with-zstd=no --with-stage1-libs=
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu
--target=x86_64-pc-linux-gnu --prefix=/prefix
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 10.0.1 20200223 (experimental) (GCC)
----


----
gccice.cpp: In function 'int func(Code, Code, bool)':
gccice.cpp:1:44: internal compiler error: in adjust_temp_type, at
cp/constexpr.c:1426
    1 | #define LIKELY(x) __builtin_expect(!!(x), 1)
      |                                            ^
gccice.cpp:14:10: note: in expansion of macro 'LIKELY'
   14 |   return LIKELY(a == b || cond) ? 0 : 1;
      |
Please submit a full bug report,
with preprocessed source if appropriate.
----


Optimization level doesn't matter and any C++ standard >= c++11 causes an ICE.

Reply via email to