public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "tstellar at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libgcc/108994] New: LLVM JIT segfaults in libgcc after upgrading from gcc 12.2.1 to 13.0.1
Date: Thu, 02 Mar 2023 18:15:26 +0000	[thread overview]
Message-ID: <bug-108994-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 108994
           Summary: LLVM JIT segfaults in libgcc after upgrading from gcc
                    12.2.1 to 13.0.1
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcc
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tstellar at redhat dot com
  Target Milestone: ---

On AArch64, I'm seeing some test failures when building the latest LLVM main
branch with gcc 13.0.1 installed on my system.  Downgrading to 12.2.1 allows
the test to pass.

For example, clang/test/Interpreter/global-dtor.cpp fails with this stack
trace:

#0  0x0000fffff7c5e608 in classify_object_over_fdes () from
/lib64/libgcc_s.so.1
#1  0x0000fffff7c5f130 in __deregister_frame_info_bases () from
/lib64/libgcc_s.so.1
#2  0x0000fffff7c5f930 in __deregister_frame () from /lib64/libgcc_s.so.1
#3  0x0000000001351bc0 in llvm_orc_deregisterEHFrameSectionWrapper ()
#4  0x0000000000db9f74 in
llvm::orc::SelfExecutorProcessControl::callWrapperAsync(llvm::orc::ExecutorAddr,
llvm::orc::ExecutorProcessControl::IncomingWFRHandler, llvm::ArrayRef<char>) ()
#5  0x0000000000da0198 in
llvm::orc::ExecutorProcessControl::callWrapper(llvm::orc::ExecutorAddr,
llvm::ArrayRef<char>) ()
#6  0x0000000000dc03d4 in llvm::Error
llvm::orc::shared::WrapperFunction<llvm::orc::shared::SPSEmpty
(llvm::orc::shared::SPSTuple<llvm::orc::shared::SPSExecutorAddr,
llvm::orc::shared::SPSExecutorAddr>)>::call<llvm::orc::ExecutorProcessControl::callSPSWrapper<void
(llvm::orc::shared::SPSTuple<llvm::orc::shared::SPSExecutorAddr,
llvm::orc::shared::SPSExecutorAddr>),
llvm::orc::ExecutorAddrRange&>(llvm::orc::ExecutorAddr,
llvm::orc::ExecutorAddrRange&)::{lambda(char const*, unsigned long)#1},
llvm::orc::shared::SPSEmpty,
llvm::orc::ExecutorAddrRange>(llvm::orc::ExecutorProcessControl::callSPSWrapper<void
(llvm::orc::shared::SPSTuple<llvm::orc::shared::SPSExecutorAddr,
llvm::orc::shared::SPSExecutorAddr>),
llvm::orc::ExecutorAddrRange&>(llvm::orc::ExecutorAddr,
llvm::orc::ExecutorAddrRange&)::{lambda(char const*, unsigned long)#1} const&,
llvm::orc::shared::SPSEmpty&, llvm::orc::ExecutorAddrRange const&) ()
#7  0x0000000000dc0358 in
llvm::orc::EPCEHFrameRegistrar::deregisterEHFrames(llvm::orc::ExecutorAddrRange)
()
#8  0x0000000000da8170 in
llvm::orc::EHFrameRegistrationPlugin::notifyRemovingResources(llvm::orc::JITDylib&,
unsigned long) ()
#9  0x0000000000da711c in
llvm::orc::ObjectLinkingLayer::handleRemoveResources(llvm::orc::JITDylib&,
unsigned long) ()
#10 0x0000000000d7336c in
llvm::orc::ExecutionSession::removeResourceTracker(llvm::orc::ResourceTracker&)
()
#11 0x0000000000d791cc in llvm::orc::JITDylib::clear() ()
#12 0x0000000000d8582c in llvm::orc::ExecutionSession::endSession() ()
#13 0x0000000000d9b014 in llvm::orc::LLJIT::~LLJIT() ()
#14 0x0000000000d9b170 in llvm::orc::LLJIT::~LLJIT() ()
#15 0x0000000000ff07e0 in clang::IncrementalExecutor::~IncrementalExecutor() ()
#16 0x0000000000fef788 in clang::Interpreter::~Interpreter() ()
#17 0x0000000000a46010 in main ()

The crashing program is clang-repl, which is a C++ interpreter, so it's
crashing while trying to run the code, not while trying to compile it.  I'm
working on getting a better reproducer, but if you have access to an AArch64
machine you can reproduce it like this:

git clone https://github.com/llvm/llvm-project
cd llvm-project
cmake -G Ninja -B build -S llvm -DCMAKE_BUILD_TYPE=release
-DLLVM_ENABLE_PROJECTS=clang -DLLVM_BUILD_LLVM_DYLIB=ON
-DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang
./build/bin/clang-repl < test.cpp
ninja -C build clang-repl

------------------------------

test.cpp:

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

struct D { float f = 1.0; D *m = nullptr; D(){} ~D() { printf("D[f=%f,
m=0x%llx]\n", f, reinterpret_cast<unsigned long long>(m)); }} d;
// CHECK: D[f=1.000000, m=0x0]

--------------------------------

             reply	other threads:[~2023-03-02 18:15 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-02 18:15 tstellar at redhat dot com [this message]
2023-03-02 18:19 ` [Bug libgcc/108994] [13 Regression] " redi at gcc dot gnu.org
2023-03-02 19:15 ` pinskia at gcc dot gnu.org
2023-03-02 19:19 ` tstellar at redhat dot com
2023-03-02 20:09 ` pinskia at gcc dot gnu.org
2023-03-03  3:13 ` tstellar at redhat dot com
2023-03-03  3:29 ` pinskia at gcc dot gnu.org
2023-03-03  7:39 ` tstellar at redhat dot com
2023-03-03  7:45 ` pinskia at gcc dot gnu.org
2023-03-03  7:46 ` pinskia at gcc dot gnu.org
2023-03-03  7:47 ` redi at gcc dot gnu.org
2023-03-03  8:45 ` [Bug target/108994] " jakub at gcc dot gnu.org
2023-03-03 18:37 ` tstellar at redhat dot com
2023-03-04  0:15 ` tstellar at redhat dot com
2023-03-06 12:37 ` [Bug target/108994] [13 Regression] LLVM JIT segfaults in libgcc after upgrading from gcc 12.2.1 to 13.0.1 since r13-2706-g6e80a1d164d1f9 marxin at gcc dot gnu.org
2023-03-09 16:29 ` tstellar at redhat dot com
2023-03-09 18:50 ` tstellar at redhat dot com
2023-03-10 17:18 ` jakub at gcc dot gnu.org
2023-03-10 17:37 ` tstellar at redhat dot com
2023-03-14  5:41 ` tstellar at redhat dot com
2023-03-14  7:04 ` jakub at gcc dot gnu.org
2023-03-14 17:22 ` tstellar at redhat dot com
2023-03-14 18:08 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-108994-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).