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

Bad code generation due to underscore #2073

Closed
Theodus opened this issue Jul 22, 2017 · 1 comment
Closed

Bad code generation due to underscore #2073

Theodus opened this issue Jul 22, 2017 · 1 comment
Assignees

Comments

@Theodus
Copy link
Contributor

Theodus commented Jul 22, 2017

The following code causes invalid LLVM IR to be generated:

actor Main
  new create(env: Env) =>
    if false then
      None
    else
      _
    end
~/src/theodus/stuff/wat/issue-_ $ ponyc -d --verify
Building builtin -> /usr/local/lib/pony/0.15.0-321b7c6b/packages/builtin
Building . -> /home/theodus/src/theodus/stuff/wat/issue-_
Generating
 Reachability
 Selector painting
 Data prototypes
 Data types
 Function prototypes
 Functions
 Descriptors
Verifying
Basic Block in function 'Main_tag_create_oo' does not have terminator!
label %if_else
Error:
Module verification failed: Basic Block in function 'Main_tag_create_oo' does not have terminator!
label %if_else
@Theodus
Copy link
Contributor Author

Theodus commented Jul 22, 2017

Here is an lldb backtrace an a debug build of the compiler in case it's useful:

~/src/theodus/stuff/wat/issue-_ $ lldb ~/src/ponylang/ponyc/build/debug/ponyc
(lldb) target create "/home/theodus/src/ponylang/ponyc/build/debug/ponyc"
Current executable set to '/home/theodus/src/ponylang/ponyc/build/debug/ponyc' (x86_64).
(lldb) run -d
Process 32460 launched: '/home/theodus/src/ponylang/ponyc/build/debug/ponyc' (x86_64)
Building builtin -> /home/theodus/src/ponylang/ponyc/packages/builtin
Building . -> /home/theodus/src/theodus/stuff/wat/issue-_
Generating
 Reachability
 Selector painting
 Data prototypes
 Data types
 Function prototypes
 Functions
 Descriptors
Writing ./issue-_.o
Process 32460 stopped
* thread #1, name = 'ponyc', stop reason = signal SIGSEGV: invalid address (fault address: 0x18)
    frame #0: 0x00007fffe8bd610b libLLVMCodeGen.so.3.9`___lldb_unnamed_symbol372$$libLLVMCodeGen.so.3.9 + 315
libLLVMCodeGen.so.3.9`___lldb_unnamed_symbol372$$libLLVMCodeGen.so.3.9:
->  0x7fffe8bd610b <+315>: cmpb   $0x1e, 0x18(%rbx)
    0x7fffe8bd610f <+319>: cmovneq %r12, %rbx
    0x7fffe8bd6113 <+323>: testq  %rbx, %rbx
    0x7fffe8bd6116 <+326>: je     0x7fffe8bd612d            ; <+349>
(lldb) bt
* thread #1, name = 'ponyc', stop reason = signal SIGSEGV: invalid address (fault address: 0x18)
  * frame #0: 0x00007fffe8bd610b libLLVMCodeGen.so.3.9`___lldb_unnamed_symbol372$$libLLVMCodeGen.so.3.9 + 315
    frame #1: 0x00007fffe6d8184f libLLVMCore.so.3.9`llvm::FPPassManager::runOnFunction(llvm::Function&) + 559
    frame #2: 0x00007fffe6d81a3b libLLVMCore.so.3.9`llvm::FPPassManager::runOnModule(llvm::Module&) + 43
    frame #3: 0x00007fffe6d81e27 libLLVMCore.so.3.9`llvm::legacy::PassManagerImpl::run(llvm::Module&) + 743
    frame #4: 0x00007fffe890fca7 libLLVMTarget.so.3.9`___lldb_unnamed_symbol24$$libLLVMTarget.so.3.9 + 327
    frame #5: 0x00007fffe890faf1 libLLVMTarget.so.3.9`LLVMTargetMachineEmitToFile + 161
    frame #6: ponyc`genobj(c=0x00007fffffffd8b0) at genobj.c:71
    frame #7: ponyc`genexe(c=0x00007fffffffd8b0, program=0x00007fffe4ddfd00) at genexe.c:437
    frame #8: ponyc`codegen(program=0x00007fffe4ddfd00, opt=0x00007fffffffddb8) at codegen.c:1028
    frame #9: ponyc`generate_passes(program=0x00007fffe4ddfd00, options=0x00007fffffffddb8) at pass.c:301
    frame #10: ponyc`compile_package(path=".", opt=0x00007fffffffddb8, print_program_ast=false, print_package_ast=false) at main.c:249
    frame #11: ponyc`main(argc=1, argv=0x00007fffffffdf28) at main.c:374
    frame #12: 0x00007fffe54d66e5 libc.so.6`__libc_start_main + 245
    frame #13: ponyc`_start at start.S:118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants