[llvm-bugs] [Bug 45329] New: segfault with frounding-math

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 27 07:34:37 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45329

            Bug ID: 45329
           Summary: segfault with frounding-math
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C
          Assignee: unassignedclangbugs at nondot.org
          Reporter: brian.cain at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Several targets fail with "-frounding-math" and a cast.  This fails on 10.0.0
but also trunk.  I discovered this while building musl for
hexagon-unknown-musl-linux.

The failure I see is a segfault.

~~~~
$ cat double_cast.c 
double a;
void b() { unsigned c = a; }

~~~~
/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang --target=mips
-frounding-math -c double_cast.c
/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang --target=powerpc
-frounding-math -c double_cast.c
/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang --target=hexagon
-frounding-math -c double_cast.c

~~~~
...

 #0 0x0000000002048214 PrintStackTraceSignalHandler(void*)
(/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang+0x2048214)
 #1 0x0000000002045ffe llvm::sys::RunSignalHandlers()
(/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang+0x2045ffe)
 #2 0x00000000020474bd llvm::sys::CleanupOnSignal(unsigned long)
(/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang+0x20474bd)
 #3 0x0000000001fde5ca CrashRecoverySignalHandler(int)
(/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang+0x1fde5ca)
 #4 0x00007f4108d04890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #5 0x0000000002b32df4 llvm::SelectionDAG::ReplaceAllUsesWith(llvm::SDNode*,
llvm::SDValue const*)
(/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang+0x2b32df4)
 #6 0x0000000002aa94fe (anonymous
namespace)::SelectionDAGLegalize::ExpandNode(llvm::SDNode*)
(/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang+0x2aa94fe)
 #7 0x0000000002a9a472 (anonymous
namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*)
(/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang+0x2a9a472)
 #8 0x0000000002a99604 llvm::SelectionDAG::Legalize()
(/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang+0x2a99604)
 #9 0x0000000002b462b5 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang+0x2b462b5)
#10 0x0000000002b45ab7
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang+0x2b45ab7)
#11 0x0000000002b433e6
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang+0x2b433e6)
#12 0x000000000102dbba
llvm::MipsDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang+0x102dbba)
#13 0x00000000018140c8
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang+0x18140c8)
#14 0x0000000001aeb6f6 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang+0x1aeb6f6)
#15 0x0000000001aeb973 llvm::FPPassManager::runOnModule(llvm::Module&)
(/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang+0x1aeb973)
#16 0x0000000001aebfc8 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang+0x1aebfc8)
#17 0x00000000021d5b3e 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> >)
(/opt/clang+llvm-10.0.0-x86_64-linux-gnu-ubuntu-18.04/bin/clang+0x21d5b3e)
...

-- 
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/20200327/a78abf05/attachment-0001.html>


More information about the llvm-bugs mailing list