Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatal error: error in backend: Unsupported expression in static initializer: addrspacecast (ptr addrspace(256) @const_pcpu_hot to ptr) #93449

Open
ubizjak opened this issue May 27, 2024 · 5 comments

Comments

@ubizjak
Copy link

ubizjak commented May 27, 2024

When compiling current -tip linux tree (27. May, 2024), with the patch series [1] that enables optimized percpu access via named address spaces also for clang applied, the compilation crashes when compiling arch/x86/kernel/cpu/common.c with:

fatal error: error in backend: Unsupported expression in static initializer: addrspacecast (ptr addrspace(256) @const_pcpu_hot to ptr)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 18.1.6 (Fedora 18.1.6-3.fc40)
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Configuration file: /etc/clang/x86_64-redhat-linux-gnu-clang.cfg
clang: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.

The preprocessed file is attached, please compile with:

clang -O2 -w -S common.i

To get:

fatal error: error in backend: Unsupported expression in static initializer: addrspacecast (ptr addrspace(256) @const_pcpu_hot to ptr)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /usr/bin/clang -O2 -w -S -fcolor-diagnostics -o common.s common.i
1.      <eof> parser at end of file
2.      Code generation
 #0 0x00007f5ab640456a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/lib64/libLLVM.so.18.1+0x60456a)
 #1 0x00007f5ab6401d54 llvm::sys::RunSignalHandlers() (/lib64/libLLVM.so.18.1+0x601d54)
 #2 0x00007f5ab6335e22 (/lib64/libLLVM.so.18.1+0x535e22)
 #3 0x00007f5ab6335ddf (/lib64/libLLVM.so.18.1+0x535ddf)
 #4 0x00007f5ab63fe22f (/lib64/libLLVM.so.18.1+0x5fe22f)
 #5 0x00000000004147c7 (/usr/bin/clang+0x4147c7)
 #6 0x00007f5ab6346a07 llvm::report_fatal_error(llvm::Twine const&, bool) (/lib64/libLLVM.so.18.1+0x546a07)
 #7 0x00007f5ab6e3117e (/lib64/libLLVM.so.18.1+0x103117e)
 #8 0x00007f5ab6e31d00 (/lib64/libLLVM.so.18.1+0x1031d00)
 #9 0x00007f5ab6e22642 llvm::AsmPrinter::emitGlobalConstant(llvm::DataLayout const&, llvm::Constant const*, llvm::DenseMap<unsigned long, llvm::SmallVector<llvm::GlobalAlias const*, 1u>, llvm::DenseMapInfo<unsigned long, void>, llvm::detail::DenseMapPair<unsigned long, llvm::SmallVector<llvm::GlobalAlias const*, 1u>>>*) (/lib64/libLLVM.so.18.1+0x1022642)
#10 0x00007f5ab6e21ab9 llvm::AsmPrinter::emitGlobalVariable(llvm::GlobalVariable const*) (/lib64/libLLVM.so.18.1+0x1021ab9)
#11 0x00007f5ab6e2c077 llvm::AsmPrinter::doFinalization(llvm::Module&) (/lib64/libLLVM.so.18.1+0x102c077)
#12 0x00007f5ab6591271 llvm::FPPassManager::doFinalization(llvm::Module&) (/lib64/libLLVM.so.18.1+0x791271)
#13 0x00007f5ab658a0a1 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/lib64/libLLVM.so.18.1+0x78a0a1)
#14 0x00007f5abe85c58b clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/lib64/libclang-cpp.so.18.1+0x185c58b)
#15 0x00007f5abec5a2a0 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/lib64/libclang-cpp.so.18.1+0x1c5a2a0)
#16 0x00007f5abd574436 clang::ParseAST(clang::Sema&, bool, bool) (/lib64/libclang-cpp.so.18.1+0x574436)
#17 0x00007f5abf81c9f6 clang::FrontendAction::Execute() (/lib64/libclang-cpp.so.18.1+0x281c9f6)
#18 0x00007f5abf794700 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/lib64/libclang-cpp.so.18.1+0x2794700)
#19 0x00007f5abf899f65 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/lib64/libclang-cpp.so.18.1+0x2899f65)
#20 0x00000000004144c6 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/bin/clang+0x4144c6)
#21 0x0000000000411164 (/usr/bin/clang+0x411164)
#22 0x00007f5abf3c5acd (/lib64/libclang-cpp.so.18.1+0x23c5acd)
#23 0x00007f5ab6335db4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/lib64/libLLVM.so.18.1+0x535db4)
#24 0x00007f5abf3c5537 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/lib64/libclang-cpp.so.18.1+0x23c5537)
#25 0x00007f5abf38b297 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/lib64/libclang-cpp.so.18.1+0x238b297)
#26 0x00007f5abf38b4f7 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/lib64/libclang-cpp.so.18.1+0x238b4f7)
#27 0x00007f5abf3a995e clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/lib64/libclang-cpp.so.18.1+0x23a995e)
#28 0x00000000004109bf clang_main(int, char**, llvm::ToolContext const&) (/usr/bin/clang+0x4109bf)
#29 0x000000000041dcca main (/usr/bin/clang+0x41dcca)
#30 0x00007f5ab583d088 __libc_start_call_main (/lib64/libc.so.6+0x2a088)
#31 0x00007f5ab583d14b __libc_start_main@GLIBC_2.2.5 (/lib64/libc.so.6+0x2a14b)
#32 0x000000000040d8a5 _start (/usr/bin/clang+0x40d8a5)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)

common.i.gz

[1] https://lore.kernel.org/lkml/[email protected]/

@nathanchance
Copy link
Member

A trivial reproducer from the full common.i usingcvise that crashes clang but GCC handles fine.

__typeof__(int __seg_gs) const_pcpu_hot;
void *__attribute____UNIQUE_ID___addressable_const_pcpu_hot612 =
    (void *)(long)&const_pcpu_hot;
$ gcc -O2 -Wall -Wextra -c -o /dev/null common.c

$ clang -O2 -Wall -Wextra -c -o /dev/null common.c
fatal error: error in backend: Unsupported expression in static initializer: addrspacecast (ptr addrspace(256) @const_pcpu_hot to ptr)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: clang -O2 -Wall -Wextra -c -o /dev/null common.c
1.      <eof> parser at end of file
2.      Code generation
 #0 0x00005601cb9a60c5 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) Signals.cpp:0:0
 #1 0x00005601cb9a5f33 llvm::sys::CleanupOnSignal(unsigned long) (/home/nathan/cbl/toolchains/llvm/18.1.6/bin/clang-18+0x4fa5f33)
 #2 0x00005601cb97779e (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) CrashRecoveryContext.cpp:0:0
 #3 0x00005601cb97775b (/home/nathan/cbl/toolchains/llvm/18.1.6/bin/clang-18+0x4f7775b)
 #4 0x00005601cb02d267 llvm::sys::Process::Exit(int, bool) (/home/nathan/cbl/toolchains/llvm/18.1.6/bin/clang-18+0x462d267)
 #5 0x00005601cb02d1e9 (/home/nathan/cbl/toolchains/llvm/18.1.6/bin/clang-18+0x462d1e9)
 #6 0x00005601c975b8d7 llvm::report_fatal_error(llvm::Twine const&, bool) (/home/nathan/cbl/toolchains/llvm/18.1.6/bin/clang-18+0x2d5b8d7)
 #7 0x00005601ce60136c llvm::DenseMapBase<llvm::DenseMap<llvm::Value*, llvm::ScopedHashTableVal<llvm::Value*, (anonymous namespace)::EarlyCSE::LoadValue>*, llvm::DenseMapInfo<llvm::Value*, void>, llvm::detail::DenseMapPair<llvm::Value*, llvm::ScopedHashTableVal<llvm::Value*, (anonymous namespace)::EarlyCSE::LoadValue>*>>, llvm::Value*, llvm::ScopedHashTableVal<llvm::Value*, (anonymous namespace)::EarlyCSE::LoadValue>*, llvm::DenseMapInfo<llvm::Value*, void>, llvm::detail::DenseMapPair<llvm::Value*, llvm::ScopedHashTableVal<llvm::Value*, (anonymous namespace)::EarlyCSE::LoadValue>*>>::grow(unsigned int) (.cold.0) EarlyCSE.cpp:0:0
 #8 0x00005601cd9d9f64 emitGlobalConstantImpl(llvm::DataLayout const&, llvm::Constant const*, llvm::AsmPrinter&, llvm::Constant const*, unsigned long, llvm::DenseMap<unsigned long, llvm::SmallVector<llvm::GlobalAlias const*, 1u>, llvm::DenseMapInfo<unsigned long, void>, llvm::detail::DenseMapPair<unsigned long, llvm::SmallVector<llvm::GlobalAlias const*, 1u>>>*) AsmPrinter.cpp:0:0
 #9 0x00005601cd9d93d9 llvm::AsmPrinter::emitGlobalVariable(llvm::GlobalVariable const*) (/home/nathan/cbl/toolchains/llvm/18.1.6/bin/clang-18+0x6fd93d9)
#10 0x00005601cdc5a56b llvm::AsmPrinter::doFinalization(llvm::Module&) (/home/nathan/cbl/toolchains/llvm/18.1.6/bin/clang-18+0x725a56b)
#11 0x00005601cdb904aa llvm::FPPassManager::doFinalization(llvm::Module&) LegacyPassManager.cpp:0:0
#12 0x00005601cdb90269 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/home/nathan/cbl/toolchains/llvm/18.1.6/bin/clang-18+0x7190269)
#13 0x00005601cddf84eb clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/home/nathan/cbl/toolchains/llvm/18.1.6/bin/clang-18+0x73f84eb)
#14 0x00005601cd7767ea clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) CodeGenAction.cpp:0:0
#15 0x00005601cd4d56b2 clang::ParseAST(clang::Sema&, bool, bool) (/home/nathan/cbl/toolchains/llvm/18.1.6/bin/clang-18+0x6ad56b2)
#16 0x00005601cddee68a clang::FrontendAction::Execute() (/home/nathan/cbl/toolchains/llvm/18.1.6/bin/clang-18+0x73ee68a)
#17 0x00005601cddee534 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/home/nathan/cbl/toolchains/llvm/18.1.6/bin/clang-18+0x73ee534)
#18 0x00005601cdf79193 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/home/nathan/cbl/toolchains/llvm/18.1.6/bin/clang-18+0x7579193)
#19 0x00005601cddebc17 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/home/nathan/cbl/toolchains/llvm/18.1.6/bin/clang-18+0x73ebc17)
#20 0x00005601cda30d74 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#21 0x00005601cda30c29 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::$_0>(long) Job.cpp:0:0
#22 0x00005601cda30bfe llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/home/nathan/cbl/toolchains/llvm/18.1.6/bin/clang-18+0x7030bfe)
#23 0x00005601cda30703 clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/home/nathan/cbl/toolchains/llvm/18.1.6/bin/clang-18+0x7030703)
#24 0x00005601cda30567 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/home/nathan/cbl/toolchains/llvm/18.1.6/bin/clang-18+0x7030567)
#25 0x00005601cda300f8 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/home/nathan/cbl/toolchains/llvm/18.1.6/bin/clang-18+0x70300f8)
#26 0x00005601cda2fa67 clang_main(int, char**, llvm::ToolContext const&) (/home/nathan/cbl/toolchains/llvm/18.1.6/bin/clang-18+0x702fa67)
#27 0x00005601cda2ed12 main (/home/nathan/cbl/toolchains/llvm/18.1.6/bin/clang-18+0x702ed12)
#28 0x00007f30a56cbc88 (/usr/lib/libc.so.6+0x25c88)
#29 0x00007f30a56cbd4c __libc_start_main (/usr/lib/libc.so.6+0x25d4c)
#30 0x00005601cdc6583e _start (/home/nathan/cbl/toolchains/llvm/18.1.6/bin/clang-18+0x726583e)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
...

@llvmbot
Copy link
Collaborator

llvmbot commented May 29, 2024

@llvm/issue-subscribers-backend-x86

Author: Uroš Bizjak (ubizjak)

When compiling current -tip linux tree (27. May, 2024), with the patch series [1] that enables optimized percpu access via named address spaces also for clang applied, the compilation crashes when compiling arch/x86/kernel/cpu/common.c with:
fatal error: error in backend: Unsupported expression in static initializer: addrspacecast (ptr addrspace(256) @<!-- -->const_pcpu_hot to ptr)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 18.1.6 (Fedora 18.1.6-3.fc40)
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Configuration file: /etc/clang/x86_64-redhat-linux-gnu-clang.cfg
clang: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.

The preprocessed file is attached, please compile with:

clang -O2 -w -S common.i

To get:

fatal error: error in backend: Unsupported expression in static initializer: addrspacecast (ptr addrspace(256) @<!-- -->const_pcpu_hot to ptr)
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /usr/bin/clang -O2 -w -S -fcolor-diagnostics -o common.s common.i
1.      &lt;eof&gt; parser at end of file
2.      Code generation
 #<!-- -->0 0x00007f5ab640456a llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/lib64/libLLVM.so.18.1+0x60456a)
 #<!-- -->1 0x00007f5ab6401d54 llvm::sys::RunSignalHandlers() (/lib64/libLLVM.so.18.1+0x601d54)
 #<!-- -->2 0x00007f5ab6335e22 (/lib64/libLLVM.so.18.1+0x535e22)
 #<!-- -->3 0x00007f5ab6335ddf (/lib64/libLLVM.so.18.1+0x535ddf)
 #<!-- -->4 0x00007f5ab63fe22f (/lib64/libLLVM.so.18.1+0x5fe22f)
 #<!-- -->5 0x00000000004147c7 (/usr/bin/clang+0x4147c7)
 #<!-- -->6 0x00007f5ab6346a07 llvm::report_fatal_error(llvm::Twine const&amp;, bool) (/lib64/libLLVM.so.18.1+0x546a07)
 #<!-- -->7 0x00007f5ab6e3117e (/lib64/libLLVM.so.18.1+0x103117e)
 #<!-- -->8 0x00007f5ab6e31d00 (/lib64/libLLVM.so.18.1+0x1031d00)
 #<!-- -->9 0x00007f5ab6e22642 llvm::AsmPrinter::emitGlobalConstant(llvm::DataLayout const&amp;, llvm::Constant const*, llvm::DenseMap&lt;unsigned long, llvm::SmallVector&lt;llvm::GlobalAlias const*, 1u&gt;, llvm::DenseMapInfo&lt;unsigned long, void&gt;, llvm::detail::DenseMapPair&lt;unsigned long, llvm::SmallVector&lt;llvm::GlobalAlias const*, 1u&gt;&gt;&gt;*) (/lib64/libLLVM.so.18.1+0x1022642)
#<!-- -->10 0x00007f5ab6e21ab9 llvm::AsmPrinter::emitGlobalVariable(llvm::GlobalVariable const*) (/lib64/libLLVM.so.18.1+0x1021ab9)
#<!-- -->11 0x00007f5ab6e2c077 llvm::AsmPrinter::doFinalization(llvm::Module&amp;) (/lib64/libLLVM.so.18.1+0x102c077)
#<!-- -->12 0x00007f5ab6591271 llvm::FPPassManager::doFinalization(llvm::Module&amp;) (/lib64/libLLVM.so.18.1+0x791271)
#<!-- -->13 0x00007f5ab658a0a1 llvm::legacy::PassManagerImpl::run(llvm::Module&amp;) (/lib64/libLLVM.so.18.1+0x78a0a1)
#<!-- -->14 0x00007f5abe85c58b clang::EmitBackendOutput(clang::DiagnosticsEngine&amp;, clang::HeaderSearchOptions const&amp;, clang::CodeGenOptions const&amp;, clang::TargetOptions const&amp;, clang::LangOptions const&amp;, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr&lt;llvm::vfs::FileSystem&gt;, std::unique_ptr&lt;llvm::raw_pwrite_stream, std::default_delete&lt;llvm::raw_pwrite_stream&gt;&gt;, clang::BackendConsumer*) (/lib64/libclang-cpp.so.18.1+0x185c58b)
#<!-- -->15 0x00007f5abec5a2a0 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&amp;) (/lib64/libclang-cpp.so.18.1+0x1c5a2a0)
#<!-- -->16 0x00007f5abd574436 clang::ParseAST(clang::Sema&amp;, bool, bool) (/lib64/libclang-cpp.so.18.1+0x574436)
#<!-- -->17 0x00007f5abf81c9f6 clang::FrontendAction::Execute() (/lib64/libclang-cpp.so.18.1+0x281c9f6)
#<!-- -->18 0x00007f5abf794700 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) (/lib64/libclang-cpp.so.18.1+0x2794700)
#<!-- -->19 0x00007f5abf899f65 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/lib64/libclang-cpp.so.18.1+0x2899f65)
#<!-- -->20 0x00000000004144c6 cc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*, void*) (/usr/bin/clang+0x4144c6)
#<!-- -->21 0x0000000000411164 (/usr/bin/clang+0x411164)
#<!-- -->22 0x00007f5abf3c5acd (/lib64/libclang-cpp.so.18.1+0x23c5acd)
#<!-- -->23 0x00007f5ab6335db4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref&lt;void ()&gt;) (/lib64/libLLVM.so.18.1+0x535db4)
#<!-- -->24 0x00007f5abf3c5537 clang::driver::CC1Command::Execute(llvm::ArrayRef&lt;std::optional&lt;llvm::StringRef&gt;&gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt;&gt;*, bool*) const (/lib64/libclang-cpp.so.18.1+0x23c5537)
#<!-- -->25 0x00007f5abf38b297 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&amp;, clang::driver::Command const*&amp;, bool) const (/lib64/libclang-cpp.so.18.1+0x238b297)
#<!-- -->26 0x00007f5abf38b4f7 clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&amp;, llvm::SmallVectorImpl&lt;std::pair&lt;int, clang::driver::Command const*&gt;&gt;&amp;, bool) const (/lib64/libclang-cpp.so.18.1+0x238b4f7)
#<!-- -->27 0x00007f5abf3a995e clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&amp;, llvm::SmallVectorImpl&lt;std::pair&lt;int, clang::driver::Command const*&gt;&gt;&amp;) (/lib64/libclang-cpp.so.18.1+0x23a995e)
#<!-- -->28 0x00000000004109bf clang_main(int, char**, llvm::ToolContext const&amp;) (/usr/bin/clang+0x4109bf)
#<!-- -->29 0x000000000041dcca main (/usr/bin/clang+0x41dcca)
#<!-- -->30 0x00007f5ab583d088 __libc_start_call_main (/lib64/libc.so.6+0x2a088)
#<!-- -->31 0x00007f5ab583d14b __libc_start_main@<!-- -->GLIBC_2.2.5 (/lib64/libc.so.6+0x2a14b)
#<!-- -->32 0x000000000040d8a5 _start (/usr/bin/clang+0x40d8a5)
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)

common.i.gz

[1] https://lore.kernel.org/lkml/20240526175655.227798-1-ubizjak@gmail.com/

@nickdesaulniers
Copy link
Member

__seg_gs is new to me. It's being expanded into __attribute__((address_space(256)) by the preprocessor. ConstantFoldConstant isn't happy with that addrspacecast. cc @arsenm , do you know why we don't or should not support such casts?

@arsenm
Copy link
Contributor

arsenm commented May 29, 2024

You can't fold an addrspacecast without target knowledge, so ConstantFoldConstant isn't going to do anything with it. The AsmPrinter would need to do something target specific with the constant expression cast, which is evidently not implemented by X86

@nickdesaulniers
Copy link
Member

cc @phoebewang @KanRobert

marcosps added a commit to marcosps/clang-extract that referenced this issue Aug 16, 2024
This happens on recent kernel tree due to issues with LLVM. As we don't
need any backends and only need to parse the source code we can disable
the warning and move on.

For more information about the issue take a look into
ClangBuiltLinux/linux#2013 and
llvm/llvm-project#93449.

Signed-off-by: Marcos Paulo de Souza <[email protected]>
giulianobelinassi pushed a commit to SUSE/clang-extract that referenced this issue Aug 16, 2024
This happens on recent kernel tree due to issues with LLVM. As we don't
need any backends and only need to parse the source code we can disable
the warning and move on.

For more information about the issue take a look into
ClangBuiltLinux/linux#2013 and
llvm/llvm-project#93449.

Signed-off-by: Marcos Paulo de Souza <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants