Closed llvmbot closed 14 years ago
This bug has been marked as a duplicate of bug llvm/llvm-project#8210
Yeah, that looks pretty straightforward.
Bill is going to work on this, using the grade school decomposition.
The trivial implementation I mentioned is useless as well as inefficient, since it would generate a 128 bit multiplication on a 32 bit machine, which libgcc at least doesn't support.
add,sub,div all seem ok, just mul is the problem.
Trivial testcase:
long long a, b; void foo() { a = a* b; }
$ clang t.c -ftrapv -m32
I can't say I'm interested. That said, it would be easy enough to do it as follows: do the multiplication in an i128 and check that nothing non-trivial ended up in the top half. I could probably be persuaded to do this :) Doubtless something much cleverer could be done, but I don't have time to think about it properly.
Duncan, do you have any interest in implementing this legalization?
Extended Description
ExpandIntegerResult #0: 0xbf71568: i64,i1 = smulo 0xbf7e5e8, 0xbf7ae08 [ORD=159] [ID=0] dbg:cpfs.c:355:5
Do not know how to expand the result of this operator! UNREACHABLE executed at LegalizeIntegerTypes.cpp:947! 0 clang 0x09bd75a3 1 clang 0x09bd7330 2 0xb7831400 __kernel_sigreturn + 0 3 libc.so.6 0xb758fa82 abort + 386 4 clang 0x09bac264 llvm::SmallVector<char, 64u>::~SmallVector() + 0 5 clang 0x096aa934 6 clang 0x0965ea98 7 clang 0x09662b88 llvm::SelectionDAG::LegalizeTypes() + 68 8 clang 0x096192b0 llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 1022 9 clang 0x09618a79 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator, llvm::ilist_iterator, bool&) + 219
10 clang 0x0961aa5c llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 1712
11 clang 0x096181b4 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 600
12 clang 0x09754521 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) + 87
13 clang 0x09b071d5 llvm::FPPassManager::runOnFunction(llvm::Function&) + 313
14 clang 0x09b0738f llvm::FPPassManager::runOnModule(llvm::Module&) + 109
15 clang 0x09b0767a llvm::MPPassManager::runOnModule(llvm::Module&) + 400
16 clang 0x09b07b30 llvm::PassManagerImpl::run(llvm::Module&) + 122
17 clang 0x09b08021 llvm::PassManager::run(llvm::Module&) + 39
18 clang 0x08ba2ee8
19 clang 0x08ba2f73 clang::EmitBackendOutput(clang::Diagnostic&, clang::CodeGenOptions const&, clang::TargetOptions const&, llvm::Module, clang::BackendAction, llvm::raw_ostream) + 70
20 clang 0x08b9f1d5
21 clang 0x08cf2fd3 clang::ParseAST(clang::Sema&, bool) + 599
22 clang 0x08a85a56 clang::ASTFrontendAction::ExecuteAction() + 254
23 clang 0x08b9ffe9 clang::CodeGenAction::ExecuteAction() + 913
24 clang 0x08a856aa clang::FrontendAction::Execute() + 316
25 clang 0x08a712ac clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 780
26 clang 0x08a2562a clang::ExecuteCompilerInvocation(clang::CompilerInstance) + 787
27 clang 0x08a1931f cc1_main(char const, char const, char const, void*) + 976
28 clang 0x08a21791 main + 521
29 libc.so.6 0xb7578bd6 __libc_start_main + 230
30 clang 0x08a18a21
Stack dump:
The line of code it mentions: assert(geo->bitmap_length * geo->bitmap_density >= geo->data_length);
which becomes
((geo->bitmap_length geo->bitmap_density >= geo->data_length) ? (void) (0) : __assert_fail ("geo->bitmap_length geo->bitmap_density >= geo->data_length", "cpfs.c", 355, __PRETTY_FUNCTION__));
All 3 variables are of type int64_t.
I can provide any and all other details as required.