Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A build crash maybe due to llvm::APInt::urem and llvm::APInt::srem #139

Closed
zyz9740 opened this issue Jan 4, 2023 · 0 comments · Fixed by leaningtech/cheerp-compiler#212
Assignees
Labels
crash the compiler crashes

Comments

@zyz9740
Copy link

zyz9740 commented Jan 4, 2023

source:

long a, b;
int main() {
  int c = 1;
  if (a++)
    for (;;)
      if (7 % (1 - c))
        for (; a < 1; b++)
          c--;
  return 0;
}

reproduce:
/opt/cheerp/bin/clang -target cheerp-wasm random.c -o random_cheerp.js > compile.cheerp.txt 2>&1
I have this log:

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /opt/cheerp/bin/opt -march=cheerp -cheerp-linear-output=wasm -cheerp-lto -passes=function(CheerpLowerInvoke),function(simplifycfg),CallConstructors,GlobalDepsAnalyzer,TypeOptimizer,function(CheerpLowerSwitch),I64Lowering,function(ReplaceNopCastsAndByteSwaps),FreeAndDeleteRemoval,default<Os>,PartialExecuter,function(simplifycfg) -o /tmp/random-3ecadc.bc /tmp/random-d3d06b.bc
 #0 0x0000000001f9fe13 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/cheerp/bin/opt+0x1f9fe13)
 #1 0x0000000001f9e0e0 llvm::sys::RunSignalHandlers() (/opt/cheerp/bin/opt+0x1f9e0e0)
 #2 0x0000000001fa02bf (/opt/cheerp/bin/opt+0x1fa02bf)
 #3 0x00007f5884fee3c0 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x143c0)
 #4 0x0000000001efb939 llvm::APInt::urem(llvm::APInt const&) const (/opt/cheerp/bin/opt+0x1efb939)
 #5 0x0000000001efc04c llvm::APInt::srem(llvm::APInt const&) const (/opt/cheerp/bin/opt+0x1efc04c)
 #6 0x00000000028574cc llvm::Interpreter::visitBinaryOperator(llvm::BinaryOperator&) (/opt/cheerp/bin/opt+0x28574cc)
 #7 0x0000000002840a6e (/opt/cheerp/bin/opt+0x2840a6e)
 #8 0x0000000002846c2f (/opt/cheerp/bin/opt+0x2846c2f)
 #9 0x00000000028430bc (/opt/cheerp/bin/opt+0x28430bc)
#10 0x000000000284314a (/opt/cheerp/bin/opt+0x284314a)
#11 0x0000000002849824 (/opt/cheerp/bin/opt+0x2849824)
#12 0x000000000284930b (/opt/cheerp/bin/opt+0x284930b)
#13 0x0000000002843480 cheerp::PartialExecuter::runOnModule(llvm::Module&) (/opt/cheerp/bin/opt+0x2843480)
#14 0x000000000284383c cheerp::PartialExecuterPass::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/cheerp/bin/opt+0x284383c)
#15 0x000000000225f41d (/opt/cheerp/bin/opt+0x225f41d)
#16 0x000000000189a687 llvm::PassManager<llvm::Module, llvm::AnalysisManager<llvm::Module> >::run(llvm::Module&, llvm::AnalysisManager<llvm::Module>&) (/opt/cheerp/bin/opt+0x189a687)
#17 0x0000000000d2272a llvm::runPassPipeline(llvm::StringRef, llvm::Module&, llvm::TargetMachine*, llvm::TargetLibraryInfoImpl*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::ToolOutputFile*, llvm::StringRef, llvm::ArrayRef<llvm::StringRef>, llvm::ArrayRef<llvm::PassPlugin>, llvm::opt_tool::OutputKind, llvm::opt_tool::VerifierKind, bool, bool, bool, bool, bool, bool) (/opt/cheerp/bin/opt+0xd2272a)
#18 0x0000000000d31ad7 main (/opt/cheerp/bin/opt+0xd31ad7)
#19 0x00007f5884aae0b3 __libc_start_main /build/glibc-sMfBJT/glibc-2.31/csu/../csu/libc-start.c:342:3
#20 0x0000000000d1b32e _start (/opt/cheerp/bin/opt+0xd1b32e)
clang-16: error: unable to execute command: Floating point exception (core dumped)
clang-16: error: optimizer command failed due to signal (use -v to see invocation)
Cheerp 1670679767-1~focal clang version 16.0.0
Target: cheerp-leaningtech-webbrowser-wasm
Thread model: posix
InstalledDir: /opt/cheerp/bin
clang-16: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-16: note: diagnostic msg: /tmp/random-992bee.c
clang-16: note: diagnostic msg: /tmp/random-992bee.sh
clang-16: note: diagnostic msg: 

********************

version:

Cheerp 1670679767-1~focal clang version 16.0.0
Target: cheerp-leaningtech-webbrowser-wasm
Thread model: posix
InstalledDir: /opt/cheerp/bin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash the compiler crashes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants