<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - 32-bit pointer address space crashes in back-end"
   href="https://bugs.llvm.org/show_bug.cgi?id=51888">51888</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>32-bit pointer address space crashes in back-end
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>12.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Backend: X86
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>akhuang@google.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>ararmine2@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>craig.topper@gmail.com, llvm-bugs@lists.llvm.org, llvm-dev@redking.me.uk, pengfei.wang@intel.com, spatel+llvm@rotateright.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The following C++ code crashes in back-end with fatal error:

extern "C" {
  extern int printf(const char *, ...);
}

const char c1[] = "foo1";

int main() {
  const char* __ptr32 cp32[] = {c1};

  printf("%s\n", cp32[0]);
}

run test with the following command:
clang test.cpp -S -target x86_64-windows-msvc -fms-extensions

Here is the crash:

fatal error: error in backend: Unsupported expression in static initializer:
addrspacecast (i8* getelementptr inbounds ([5 x i8], [5 x i8]* @c1, i64 0, i64
0) to i8 addrspace(270)*)
Stack dump:
0.  Program arguments: clang test.cpp -S -target x86_64-windows-msvc
-fms-extensions 
1.  <eof> parser at end of file
2.  Code generation
 #0 0x000055e67233ac8e llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/armine/llvm/release_build/bin/clang-10+0x1958c8e)
 #1 0x000055e6723389d4 llvm::sys::RunSignalHandlers()
(/home/armine/llvm/release_build/bin/clang-10+0x19569d4)
 #2 0x000055e672338c51 llvm::sys::CleanupOnSignal(unsigned long)
(/home/armine/llvm/release_build/bin/clang-10+0x1956c51)
 #3 0x000055e6722b4548 llvm::CrashRecoveryContext::HandleExit(int)
(/home/armine/llvm/release_build/bin/clang-10+0x18d2548)
 #4 0x000055e67233189b llvm::sys::Process::Exit(int)
(/home/armine/llvm/release_build/bin/clang-10+0x194f89b)
 #5 0x000055e67132cd87 LLVMErrorHandler(void*, std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, bool)
(/home/armine/llvm/release_build/bin/clang-10+0x94ad87)
 #6 0x000055e6722badbb llvm::report_fatal_error(llvm::Twine const&, bool)
(/home/armine/llvm/release_build/bin/clang-10+0x18d8dbb)
 #7 0x000055e6722baf4d (/home/armine/llvm/release_build/bin/clang-10+0x18d8f4d)
 #8 0x000055e672db19f3 (/home/armine/llvm/release_build/bin/clang-10+0x23cf9f3)
 #9 0x000055e672db13c8 llvm::AsmPrinter::lowerConstant(llvm::Constant const*)
(/home/armine/llvm/release_build/bin/clang-10+0x23cf3c8)
#10 0x000055e672db4c33 emitGlobalConstantImpl(llvm::DataLayout const&,
llvm::Constant const*, llvm::AsmPrinter&, llvm::Constant const*, unsigned long)
(/home/armine/llvm/release_build/bin/clang-10+0x23d2c33)
#11 0x000055e672db4b0e emitGlobalConstantImpl(llvm::DataLayout const&,
llvm::Constant const*, llvm::AsmPrinter&, llvm::Constant const*, unsigned long)
(/home/armine/llvm/release_build/bin/clang-10+0x23d2b0e)
#12 0x000055e672db7153
llvm::AsmPrinter::EmitGlobalVariable(llvm::GlobalVariable const*)
(/home/armine/llvm/release_build/bin/clang-10+0x23d5153)
#13 0x000055e672db9a09 llvm::AsmPrinter::doFinalization(llvm::Module&)
(/home/armine/llvm/release_build/bin/clang-10+0x23d7a09)
#14 0x000055e671cf46e5 llvm::FPPassManager::doFinalization(llvm::Module&)
(.localalias) (/home/armine/llvm/release_build/bin/clang-10+0x13126e5)
#15 0x000055e671d021e0 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/armine/llvm/release_build/bin/clang-10+0x13201e0)
#16 0x000055e67259b17c clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/home/armine/llvm/release_build/bin/clang-10+0x1bb917c)
#17 0x000055e673197629
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/home/armine/llvm/release_build/bin/clang-10+0x27b5629)
#18 0x000055e673dcc8c1 clang::ParseAST(clang::Sema&, bool, bool)
(/home/armine/llvm/release_build/bin/clang-10+0x33ea8c1)
#19 0x000055e672b72d39 clang::FrontendAction::Execute()
(/home/armine/llvm/release_build/bin/clang-10+0x2190d39)
#20 0x000055e672b2a72b
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/armine/llvm/release_build/bin/clang-10+0x214872b)
#21 0x000055e672c495eb
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/armine/llvm/release_build/bin/clang-10+0x22675eb)
#22 0x000055e67132d424 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/armine/llvm/release_build/bin/clang-10+0x94b424)
#23 0x000055e67132b28a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&)
(/home/armine/llvm/release_build/bin/clang-10+0x94928a)
#24 0x000055e6729f48c9 void llvm::function_ref<void
()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
std::allocator<char> >*, bool*) const::'lambda'()>(long)
(/home/armine/llvm/release_build/bin/clang-10+0x20128c9)
#25 0x000055e6722b43c7
llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>)
(/home/armine/llvm/release_build/bin/clang-10+0x18d23c7)
#26 0x000055e6729f54de
clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>
<span class="quote">>, std::__cxx11::basic_string<char, std::char_traits<char>,</span >
std::allocator<char> >*, bool*) const (.part.0)
(/home/armine/llvm/release_build/bin/clang-10+0x20134de)
#27 0x000055e6729cbefc
clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&,
clang::driver::Command const*&) const
(/home/armine/llvm/release_build/bin/clang-10+0x1fe9efc)
#28 0x000055e6729cc7f9
clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&) const
(/home/armine/llvm/release_build/bin/clang-10+0x1fea7f9)
#29 0x000055e6729d457f
clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&,
llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*> >&)
(/home/armine/llvm/release_build/bin/clang-10+0x1ff257f)
#30 0x000055e6712bebfe main
(/home/armine/llvm/release_build/bin/clang-10+0x8dcbfe)
#31 0x00007f531fed10b3 __libc_start_main
/build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:342:3
#32 0x000055e67132ae6e _start
(/home/armine/llvm/release_build/bin/clang-10+0x948e6e)</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>