[llvm-bugs] [Bug 49192] New: Clang++ segfault with -O2 -flto=thin
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Feb 15 06:15:42 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=49192
Bug ID: 49192
Summary: Clang++ segfault with -O2 -flto=thin
Product: clang
Version: unspecified
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: C++17
Assignee: unassignedclangbugs at nondot.org
Reporter: ext-llvm at burakarslan.com
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
Created attachment 24528
--> https://bugs.llvm.org/attachment.cgi?id=24528&action=edit
Crash report
First, apologies if this is the wrong place to report this bug, clang is a huge
project and it's a bit difficult to navigate for a newbie.
Here's the clang that segfaults:
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.4.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Host is a macOS 10.15.4 (19E287) from http://dosdude1.com/catalina/ running on
an old intel MBP
According to [1] this is a backend bug. Additionally, I can confirm it doesn't
occur with -O1 instead of -O2, or with the -flto=thin argument absent. In other
words, both -O2 -flto=thin must be passed for the segfault to occur.
It occurs only on one of the compilation units, and when I work around it by
passing -O1, it also occurs during the linking stage at the end.
I generated the foo.bc file and unlike what the guide says, the segfault
doesn't happen when the compiler is given the .bc file directly but fails with
an invalid forward reference error instead. Apple doesn't provide the llc
binary but I ran the following:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
foo.bc -Wl,-flto=thin -Wl,-O2
foo.bc:41290:15: error: invalid forward reference to function '<some mangled
name>' with wrong type
It's the same result with -Wl,-relocation-model=static or
-Wl,-relocation-model=pic
I downloaded the clang-11 darwin binaries from [2] and the result is the same
using the llc command from the archive.
I also have the preprocessed source code and the full command line from the
crash report, as well as the foo.bc file but I can't say I'm comfortable with
posting them on a public forum. Is there another channel (eg. someone's email)
I can use to post additional data?
I also have clang 11.0.0 running on Linux on another machine compiling the same
code with similar flags. The relevant compilation operation runs just fine but
the linking stage still fails with a segfault. I have
/usr/x86_64-pc-linux-gnu/binutils-bin/lib/bfd-plugins/LLVMgold.so file present
though nothing in the command line seems to indicate that it's using the gold
linker. I'm not sure whether -flto=thin implies gold linker. Should I report
that in another bug report?
I'll be happy to help if you need additional info.
[1]: https://www.llvm.org/docs/HowToSubmitABug.html#crashing-bugs
[2]: https://releases.llvm.org/download.html
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210215/1c406569/attachment.html>
More information about the llvm-bugs
mailing list