<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 - segfault with frounding-math"
   href="https://bugs.llvm.org/show_bug.cgi?id=45329">45329</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>segfault with frounding-math
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>enhancement
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>C
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>brian.cain@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, dgregor@apple.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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)
...</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>