[llvm-bugs] [Bug 46337] New: __builtin_mul_overflow does not support signed _ExtInt operands of more then 128 bits; reports a fatal error in the DAG legalizer

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jun 15 22:20:15 PDT 2020


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

            Bug ID: 46337
           Summary: __builtin_mul_overflow does not support signed _ExtInt
                    operands of more then 128 bits; reports a fatal error
                    in the DAG legalizer
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: jeffrey.t.mott at intel.com
                CC: llvm-bugs at lists.llvm.org

$ cat test.c

        int main() {
            _ExtInt(129) x = 1;
            _ExtInt(129) y = 1;
            _ExtInt(129) result;
            return __builtin_mul_overflow(x, y, &result);
        }

    $ cat test.ll

        ; ModuleID = 'test.c'
        source_filename = "test.c"
        target datalayout =
"e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
        target triple = "x86_64-unknown-linux-gnu"

        ; Function Attrs: noinline nounwind optnone uwtable
        define dso_local i32 @main() #0 {
        entry:
          %retval = alloca i32, align 4
          %x = alloca i129, align 8
          %y = alloca i129, align 8
          %result = alloca i129, align 8
          store i32 0, i32* %retval, align 4
          store i129 1, i129* %x, align 8
          store i129 1, i129* %y, align 8
          %0 = load i129, i129* %x, align 8
          %1 = load i129, i129* %y, align 8
          %2 = call { i129, i1 } @llvm.smul.with.overflow.i129(i129 %0, i129
%1)
          %3 = extractvalue { i129, i1 } %2, 1
          %4 = extractvalue { i129, i1 } %2, 0
          store i129 %4, i129* %result, align 8
          %conv = zext i1 %3 to i32
          ret i32 %conv
        }

        ; Function Attrs: nounwind readnone speculatable willreturn
        declare { i129, i1 } @llvm.smul.with.overflow.i129(i129, i129) #1

        attributes #0 = { noinline nounwind optnone uwtable
"correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false"
"frame-pointer"="all" "less-precise-fpmad"="false" "min-legal-vector-width"="0"
"no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false"
"no-signed-zeros-fp-math"="false" "no-trapping-math"="true"
"stack-protector-buffer-size"="8" "target-cpu"="x86-64"
"target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false"
"use-soft-float"="false" }
        attributes #1 = { nounwind readnone speculatable willreturn }

        !llvm.module.flags = !{!0}
        !llvm.ident = !{!1}

        !0 = !{i32 1, !"wchar_size", i32 4}
        !1 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git
5ddd4fc5a65a452dffa2d27ad6a5c04d148d6234)"}

    $ clang -rtlib=compiler-rt test.ll

        clang-11:
/home/jtmott/llvm_workspace/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:3712:
void llvm::DAGTypeLegalizer::ExpandIntRes_XMULO(llvm::SDNode*, llvm::SDValue&,
llvm::SDValue&): Assertion `LC != RTLIB::UNKNOWN_LIBCALL && "Unsupported
XMULO!"' failed.
        PLEASE submit a bug report to https://bugs.llvm.org/ and include the
crash backtrace, preprocessed source, and associated run script.
        Stack dump:
        0.  Program arguments: /home/jtmott/llvm_workspace/build/bin/clang-11
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-main-file-name test.ll -mrelocation-model static -mframe-pointer=all
-fmath-errno -fno-rounding-math -mconstructor-aliases -munwind-tables
-target-cpu x86-64 -dwarf-column-info -fno-split-dwarf-inlining
-debugger-tuning=gdb -resource-dir
/home/jtmott/llvm_workspace/build/lib/clang/11.0.0 -fdebug-compilation-dir
/home/jtmott/llvm_workspace -ferror-limit 19 -fgnuc-version=4.2.1
-fcolor-diagnostics -faddrsig -o /tmp/test-f846fd.o -x ir test.ll 
        1.  Code generation
        2.  Running pass 'Function Pass Manager' on module 'test.ll'.
        3.  Running pass 'X86 DAG->DAG Instruction Selection' on function
'@main'
         #0 0x00000000039b9bb1 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/jtmott/llvm_workspace/llvm-project/llvm/lib/Support/Unix/Signals.inc:564:0
         #1 0x00000000039b9c44 PrintStackTraceSignalHandler(void*)
/home/jtmott/llvm_workspace/llvm-project/llvm/lib/Support/Unix/Signals.inc:625:0
         #2 0x00000000039b79df llvm::sys::RunSignalHandlers()
/home/jtmott/llvm_workspace/llvm-project/llvm/lib/Support/Signals.cpp:68:0
         #3 0x00000000039b952e SignalHandler(int)
/home/jtmott/llvm_workspace/llvm-project/llvm/lib/Support/Unix/Signals.inc:406:0
         #4 0x00007fd4e8f9f390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
         #5 0x00007fd4e80f1428 raise
/build/glibc-LK5gWL/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
         #6 0x00007fd4e80f302a abort
/build/glibc-LK5gWL/glibc-2.23/stdlib/abort.c:91:0
         #7 0x00007fd4e80e9bd7 __assert_fail_base
/build/glibc-LK5gWL/glibc-2.23/assert/assert.c:92:0
         #8 0x00007fd4e80e9c82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
         #9 0x0000000004e867c9
llvm::DAGTypeLegalizer::ExpandIntRes_XMULO(llvm::SDNode*, llvm::SDValue&,
llvm::SDValue&)
/home/jtmott/llvm_workspace/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:3714:0
        #10 0x0000000004e74c91
llvm::DAGTypeLegalizer::ExpandIntegerResult(llvm::SDNode*, unsigned int)
/home/jtmott/llvm_workspace/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp:2007:0
        #11 0x0000000004de70ac llvm::DAGTypeLegalizer::run()
/home/jtmott/llvm_workspace/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp:262:0
        #12 0x0000000004deb6fe llvm::SelectionDAG::LegalizeTypes()
/home/jtmott/llvm_workspace/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp:1056:0
        #13 0x0000000004d8106f llvm::SelectionDAGISel::CodeGenAndEmitDAG()
/home/jtmott/llvm_workspace/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:840:0
        #14 0x0000000004d805b3
llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction,
true, false, void>, false, true>,
llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true,
false, void>, false, true>, bool&)
/home/jtmott/llvm_workspace/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:740:0
        #15 0x0000000004d851cb
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
/home/jtmott/llvm_workspace/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1619:0
        #16 0x0000000004d7eeff
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
/home/jtmott/llvm_workspace/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:505:0
        #17 0x0000000002223fd5 (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
/home/jtmott/llvm_workspace/llvm-project/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp:195:0
        #18 0x0000000002a9ce3b
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
/home/jtmott/llvm_workspace/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:73:0
        #19 0x00000000030d1ea0
llvm::FPPassManager::runOnFunction(llvm::Function&)
/home/jtmott/llvm_workspace/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1482:0
        #20 0x00000000030d2141 llvm::FPPassManager::runOnModule(llvm::Module&)
/home/jtmott/llvm_workspace/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1518:0
        #21 0x00000000030d2569 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/home/jtmott/llvm_workspace/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1583:0
        #22 0x00000000030d2d43
llvm::legacy::PassManagerImpl::run(llvm::Module&)
/home/jtmott/llvm_workspace/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1695:0
        #23 0x00000000030d2f3b llvm::legacy::PassManager::run(llvm::Module&)
/home/jtmott/llvm_workspace/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1727:0
        #24 0x0000000003d38ea8 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
/home/jtmott/llvm_workspace/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:959:0
        #25 0x0000000003d3dd84
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/jtmott/llvm_workspace/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1666:0
        #26 0x0000000004e9a33c clang::CodeGenAction::ExecuteAction()
/home/jtmott/llvm_workspace/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:1173:0
        #27 0x00000000045852f2 clang::FrontendAction::Execute()
/home/jtmott/llvm_workspace/llvm-project/clang/lib/Frontend/FrontendAction.cpp:957:0
        #28 0x0000000004519d36
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
/home/jtmott/llvm_workspace/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:973:0
        #29 0x00000000046fee99
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
/home/jtmott/llvm_workspace/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:282:0
        #30 0x000000000212c9d0 cc1_main(llvm::ArrayRef<char const*>, char
const*, void*)
/home/jtmott/llvm_workspace/llvm-project/clang/tools/driver/cc1_main.cpp:240:0
        #31 0x0000000002122074 ExecuteCC1Tool(llvm::SmallVectorImpl<char
const*>&)
/home/jtmott/llvm_workspace/llvm-project/clang/tools/driver/driver.cpp:330:0
        #32 0x0000000002122846 main
/home/jtmott/llvm_workspace/llvm-project/clang/tools/driver/driver.cpp:407:0
        #33 0x00007fd4e80dc830 __libc_start_main
/build/glibc-LK5gWL/glibc-2.23/csu/../csu/libc-start.c:325:0
        #34 0x0000000002120729 _start
(/home/jtmott/llvm_workspace/build/bin/clang-11+0x2120729)
        clang-11: error: unable to execute command: Aborted (core dumped)
        clang-11: error: clang frontend command failed due to signal (use -v to
see invocation)
        clang version 11.0.0 (https://github.com/llvm/llvm-project.git
5ddd4fc5a65a452dffa2d27ad6a5c04d148d6234)
        Target: x86_64-unknown-linux-gnu
        Thread model: posix
        InstalledDir: /home/jtmott/llvm_workspace/build/bin
        clang-11: note: diagnostic msg: Error generating preprocessed source(s)
- no preprocessable inputs.

Similar bug for normal division: https://bugs.llvm.org/show_bug.cgi?id=45649

-- 
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/20200616/2bd58f9e/attachment-0001.html>


More information about the llvm-bugs mailing list