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

Error catching wishlist #81

Open
GlowingScrewdriver opened this issue Jul 18, 2024 · 4 comments
Open

Error catching wishlist #81

GlowingScrewdriver opened this issue Jul 18, 2024 · 4 comments

Comments

@GlowingScrewdriver
Copy link
Contributor

C-Lisp should catch a lot more errors. Let's use this issue to make a note of errors that we want to be caught, so that we can work on it in the future.

@GlowingScrewdriver
Copy link
Contributor Author

The following function returns a value whereas it is declared to return nothing.

(c-lisp
    (define ((returns-int void))
        (ret 6)))

It doesn't compile. Brilisp throws the following error:

CodegenError: Unknown variable: tmp_clisp.ret_ptr-sjdpkkgp

This is because gen_ret_stmt assumes that there is a return pointer, since a return value (6 here) is specfied in the return statement.

@chsasank
Copy link
Owner

(base) sasank@johnaic:~/code/sycl/llama.lisp/src/backend/tests/bench/mmult4$ bash compile.sh 
Traceback (most recent call last):
  File "/home/sasank/code/sycl/llama.lisp/src/backend/llvm.py", line 399, in <module>
    main()
  File "/home/sasank/code/sycl/llama.lisp/src/backend/llvm.py", line 394, in main
    code_gen.generate(bril_prog)
  File "/home/sasank/code/sycl/llama.lisp/src/backend/llvm.py", line 44, in generate
    self.gen_function(fn)
  File "/home/sasank/code/sycl/llama.lisp/src/backend/llvm.py", line 385, in gen_function
    self.gen_instructions(fn_instrs)
  File "/home/sasank/code/sycl/llama.lisp/src/backend/llvm.py", line 301, in gen_instructions
    raise e
  File "/home/sasank/code/sycl/llama.lisp/src/backend/llvm.py", line 282, in gen_instructions
    gen_store(instr)
  File "/home/sasank/code/sycl/llama.lisp/src/backend/llvm.py", line 227, in gen_store
    self.builder.store(self.gen_var(instr.args[1]), ptr)
  File "/home/sasank/miniconda3/lib/python3.11/site-packages/llvmlite/ir/builder.py", line 778, in store
    raise TypeError("cannot store %s to %s: mismatching types"
TypeError: cannot store i32 to float*: mismatching types

Can't find where the error in original program.

@GlowingScrewdriver
Copy link
Contributor Author

Type checking function call arguments would also be useful

@chsasank
Copy link
Owner

With the new framework in #82 it should be quite easy.

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