Skip to content

New LLVM backend cannot compile procedures with type #656

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

Closed
ThisDevDane opened this issue May 24, 2020 · 0 comments
Closed

New LLVM backend cannot compile procedures with type #656

ThisDevDane opened this issue May 24, 2020 · 0 comments

Comments

@ThisDevDane
Copy link
Member

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

  • Operating System: Win 10 x64 Version 1909
  • Odin version/Commit: 732c745

Expected Behavior

For the example to compile using --llvm-api.
This seems to be related to when declaring functions like name : delegate_type : proc()

Current Behavior

It fails to compile with --llvm-api

Failure Information (for bugs)

When compiling the example with --llvm-api following error gets raised;

[Build Debug]
odin build ./generator_v2 --out=odin-imgui-gen.exe --llvm-api --debug
e:\odin\src\llvm_backend.cpp(2359): Assertion Failure: `(p->type_expr)->kind == GB_JOIN2(Ast_, ProcType)` expected 'procedure type' got 'selector expression'
make: *** [Makefile:27: build_debug] Error -2147483645

Steps to Reproduce

  1. Compile the following code with --llvm-api
package main

import "core:fmt"
import "core:os"
import "core:log"
import "core:odin/ast"
import "core:odin/tokenizer"
import "core:odin/parser"

main :: proc() {
    predefined_file := ast.File {
        fullpath = "imgui_predefined.odin"
    };
    src, _ := os.read_entire_file(predefined_file.fullpath);
    predefined_file.src = src;

    err_log : parser.Error_Handler : proc(pos: tokenizer.Pos, msg: string, args: ..any) {
        log.errorf("%s(%d:%d): ", pos.file, pos.line, pos.column);
        log.errorf(msg, ..args);
    }

    warn_log : parser.Warning_Handler : proc(pos: tokenizer.Pos, msg: string, args: ..any) {
        log.warnf("%s(%d:%d): ", pos.file, pos.line, pos.column);
        log.warnf(msg, ..args);
    }

    p := parser.Parser {
        err  = err_log,
        warn = warn_log,
    };

    ok := parser.parse_file(&p, &predefined_file);
    if ok == false || p.error_count > 0 {
        log.error("FAILED TO PARSE 'predefined_imgui.odin'");
        os.exit(1);
    }

    fmt.println("DONE");
}

Failure Logs

Please include any relevant log snippets or files here.

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

No branches or pull requests

1 participant