HomePhabricator

DR2064: decltype(E) is only a dependent type if E is type-dependent, not

Authored by rsmith on Dec 17 2020, 2:36 PM.

Description

DR2064: decltype(E) is only a dependent type if E is type-dependent, not
if E is merely instantiation-dependent.

Event Timeline

Hello.

This diff seems to be causing issue building llvm with clang-tools-extra;openmp projects enabled. Basically in self hoisting mode.

FAILED: projects/openmp/libomptarget/src/CMakeFiles/omptarget.dir/device.cpp.o
/home/ayermolo/local/llvm-build-upstream-release/bin/clang++ -DGTEST_HAS_RTTI=0 -DOMPTARGET_PROFILE_ENABLED -D_DEBUG -D_GNU_SOURCE -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -Iprojects/openmp/libomptarget/src -I/home/ayermolo/local/server-llvm/llvm-project/openmp/libomptarget/src -Iinclude -I/home/ayermolo/local/server-llvm/llvm-project/llvm/include -I/home/ayermolo/local/server-llvm/llvm-project/openmp/libomptarget/include -fstandalone-debug -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -Wcast-qual -Wformat-pedantic -Wimplicit-fallthrough -Wsign-compare -Wno-extra -Wno-pedantic -std=gnu++14 -O2 -fPIC -fno-exceptions -fno-rtti -UNDEBUG -std=c++14 -MD -MT projects/openmp/libomptarget/src/CMakeFiles/omptarget.dir/device.cpp.o -MF projects/openmp/libomptarget/src/CMakeFiles/omptarget.dir/device.cpp.o.d -o projects/openmp/libomptarget/src/CMakeFiles/omptarget.dir/device.cpp.o -c /home/ayermolo/local/server-llvm/llvm-project/openmp/libomptarget/src/device.cpp
clang++: /home/ayermolo/local/upstream-llvm/llvm-project/clang/lib/AST/ItaniumMangle.cpp:5798: void (anonymous namespace)::CXXNameMangler::addSubstitution(uintptr_t): Assertion `!Substitutions.count(Ptr) && "Substitution already exists!"' failed.
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /home/ayermolo/local/llvm-build-upstream-release/bin/clang++ -DGTEST_HAS_RTTI=0 -DOMPTARGET_PROFILE_ENABLED -D_DEBUG -D_GNU_SOURCE -D
STDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -DSTDC_LIMIT_MACROS -Iprojects/openmp/libomptarget/src -I/home/ayermolo/local/server-llvm/llvm-project/openmp/libomptarget/src -Iinclude -I/home/ayermolo/local/server-llvm/llvm-project/llvm/include -I/home/ayermolo/local/server-llvm/llvm-project/openmp/libomptarget/include -fstandalone-debug -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -Wall -Wcast-qual -Wformat-pedantic -Wimplicit-fallthrough -Wsign-compare -Wno-extra -Wno-pedantic -std=gnu++14 -O2 -fPIC -fno-exceptions -fno-rtti -UNDEBUG -std=c++14 -MD -MT projects/openmp/libomptarget/src/CMakeFiles/omptarget.dir/device.cpp.o -MF projects/openmp/libomptarget/src/CMakeFiles/omptarget.dir/device.cpp.o.d -o projects/openmp/libomptarget/src/CMakeFiles/omptarget.dir/device.cpp.o -c /home/ayermolo/local/server-llvm/llvm-project/openmp/libomptarget/src/device.cpp

  1. /home/ayermolo/local/server-llvm/llvm-project/openmp/libomptarget/src/device.cpp:97:1: current parser token 'int'
  2. /home/ayermolo/local/server-llvm/llvm-project/openmp/libomptarget/src/device.cpp:58:15: LLVM IR generation of declaration 'DeviceTy::associatePtr'
  3. /home/ayermolo/local/server-llvm/llvm-project/openmp/libomptarget/src/device.cpp:58:15: Generating code for declaration 'DeviceTy::associatePtr'
  4. /usr/lib/gcc/x86_64-redhat-linux/8/../../../../include/c++/8/bits/stl_set.h:785:2: Mangling declaration 'std::set<HostDataToTargetTy, std::less<>>::find' #0 0x0000000002ed1953 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/ayermolo/local/llvm-build-upstream-release/bin/clang+++0x2ed1953) #1 0x0000000002ecfbf0 llvm::sys::RunSignalHandlers() (/home/ayermolo/local/llvm-build-upstream-release/bin/clang+++0x2ecfbf0) #2 0x0000000002ed0fed llvm::sys::CleanupOnSignal(unsigned long) (/home/ayermolo/local/llvm-build-upstream-release/bin/clang+++0x2ed0fed) #3 0x0000000002e517c3 (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) (/home/ayermolo/local/llvm-build-upstream-release/bin/clang+++0x2e517c3) #4 0x0000000002e51948 CrashRecoverySignalHandler(int) (/home/ayermolo/local/llvm-build-upstream-release/bin/clang+++0x2e51948) #5 0x00007f14be291b30 __restore_rt (/lib64/libpthread.so.0+0x12b30) #6 0x00007f14bcfa180f raise (/lib64/libc.so.6+0x3780f) #7 0x00007f14bcf8bc45 abort (/lib64/libc.so.6+0x21c45) #8 0x00007f14bcf8bb19 _nl_load_domain.cold.0 (/lib64/libc.so.6+0x21b19) #9 0x00007f14bcf99df6 (/lib64/libc.so.6+0x2fdf6)

#10 0x00000000054111fb (anonymous namespace)::CXXNameMangler::addSubstitution(clang::QualType) (/home/ayermolo/local/llvm-build-upstream-release/bin/clang+++0x54111fb)
#11 0x000000000540de5a (anonymous namespace)::CXXNameMangler::mangleType(clang::QualType) (/home/ayermolo/local/llvm-build-upstream-release/bin/clang+++0x540de5a)
#12 0x000000000541e0be (anonymous namespace)::CXXNameMangler::mangleBareFunctionType(clang::FunctionProtoType const*, bool, clang::FunctionDecl const*) (/home/ayermolo/local/llvm-build-upstream-release/bin/clang+++0x541e0be)
#13 0x000000000540a880 (anonymous namespace)::CXXNameMangler::mangleFunctionEncoding(clang::GlobalDecl) (/home/ayermolo/local/llvm-build-upstream-release/bin/clang+++0x540a880)
#14 0x0000000005408275 (anonymous namespace)::ItaniumMangleContextImpl::mangleCXXName(clang::GlobalDecl, llvm::raw_ostream&) (/home/ayermolo/local/llvm-build-upstream-release/bin/clang+++0x5408275)

To reproduce this config should do the trick:

MYCLANG=/opt/llvm/bin/clang

BUILDTYPE=Release
cmake \

-G Ninja \
-DCMAKE_CXX_COMPILER=$MYCLANG++ \
-DCMAKE_C_COMPILER=$MYCLANG \
-DCMAKE_ASM_COMPILER=$MYCLANG \
-DCMAKE_ASM_COMPILER_ID=Clang \
-DLLVM_TARGETS_TO_BUILD="X86" \
-DLLVM_ENABLE_LLD=ON\
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;openmp;lld" \
-DCMAKE_BUILD_TYPE=$BUILDTYPE \
-DLLVM_ENABLE_ASSERTIONS=ON \
-DCMAKE_C_FLAGS="-fstandalone-debug" \
-DCMAKE_CXX_FLAGS="-fstandalone-debug" \
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 \
-DCLANG_ENABLE_BOOTSTRAP=On \
-DCLANG_BOOTSTRAP_PASSTHROUGH="CMAKE_INSTALL_PREFIX;CMAKE_VERBOSE_MAKEFILE" \
../upstream-llvm/llvm-project/llvm/

Run: ninja stage2

@rsmith can this be reverted in the meantime? I do not have commit access.