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

Crystal Compiler error: Module validation failed: GEP base pointer is not a vector or a vector of pointers #14985

Open
stephannv opened this issue Sep 6, 2024 · 1 comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc.

Comments

@stephannv
Copy link

stephannv commented Sep 6, 2024

Bug Report

Reproducible in: 1.13.2, 1.12.1 (I didn't try other versions). I could reproduce it on apple silicon and crystal playground.

I'm not sure if this is related to #14984, but the error message is different.

Playground here: https://play.crystal-lang.org/#/r/h5y7

class Bar
  getter list : Enumerable(String | Path) | Enumerable(String) | Enumerable(Path)

  def initialize(@list); end

  def self.bar(*elements : String | Path)
    bar(elements)
  end

  def self.bar(list : Enumerable)
    new(list)
  end
end

Bar.bar("hello")
Complete stacktrace
Module validation failed: GEP base pointer is not a vector or a vector of pointers
  %17 = getelementptr inbounds %"(Array(String) | Dir | Dir::ChildIterator | Dir::EntryIterator | Path::PartIterator | String::LineIterator | Tuple(String) | Tuple(String, String, String) | Tuple(String, String, String, String))", %"(Array(String) | Dir | Dir::ChildIterator | Dir::EntryIterator | Path::PartIterator | String::LineIterator | Tuple(String) | Tuple(String, String, String) | Tuple(String, String, String, String))" %16, i32 0, i32 0, !dbg !18
Load operand must be a pointer.
  %18 = load i32, %"(Array(String) | Dir | Dir::ChildIterator | Dir::EntryIterator | Path::PartIterator | String::LineIterator | Tuple(String) | Tuple(String, String, String) | Tuple(String, String, String, String))" %17, align 4, !dbg !18
GEP base pointer is not a vector or a vector of pointers
  %19 = getelementptr inbounds %"(Array(String) | Dir | Dir::ChildIterator | Dir::EntryIterator | Path::PartIterator | String::LineIterator | Tuple(String) | Tuple(String, String, String) | Tuple(String, String, String, String))", %"(Array(String) | Dir | Dir::ChildIterator | Dir::EntryIterator | Path::PartIterator | String::LineIterator | Tuple(String) | Tuple(String, String, String) | Tuple(String, String, String, String))" %16, i32 0, i32 1, !dbg !18
GEP base pointer is not a vector or a vector of pointers
  %27 = getelementptr inbounds %"(Array(String) | Dir | Dir::ChildIterator | Dir::EntryIterator | Path::PartIterator | String::LineIterator | Tuple(String) | Tuple(String, String, String) | Tuple(String, String, String, String))", %"(Array(String) | Dir | Dir::ChildIterator | Dir::EntryIterator | Path::PartIterator | String::LineIterator | Tuple(String) | Tuple(String, String, String) | Tuple(String, String, String, String))" %26, i32 0, i32 0, !dbg !18
Load operand must be a pointer.
  %28 = load i32, %"(Array(String) | Dir | Dir::ChildIterator | Dir::EntryIterator | Path::PartIterator | String::LineIterator | Tuple(String) | Tuple(String, String, String) | Tuple(String, String, String, String))" %27, align 4, !dbg !18
GEP base pointer is not a vector or a vector of pointers
  %29 = getelementptr inbounds %"(Array(String) | Dir | Dir::ChildIterator | Dir::EntryIterator | Path::PartIterator | String::LineIterator | Tuple(String) | Tuple(String, String, String) | Tuple(String, String, String, String))", %"(Array(String) | Dir | Dir::ChildIterator | Dir::EntryIterator | Path::PartIterator | String::LineIterator | Tuple(String) | Tuple(String, String, String) | Tuple(String, String, String, String))" %26, i32 0, i32 1, !dbg !18
GEP base pointer is not a vector or a vector of pointers
  %37 = getelementptr inbounds %"(Array(String) | Dir | Dir::ChildIterator | Dir::EntryIterator | Path::PartIterator | String::LineIterator | Tuple(String) | Tuple(String, String, String) | Tuple(String, String, String, String))", %"(Array(String) | Dir | Dir::ChildIterator | Dir::EntryIterator | Path::PartIterator | String::LineIterator | Tuple(String) | Tuple(String, String, String) | Tuple(String, String, String, String))" %36, i32 0, i32 0, !dbg !18
Load operand must be a pointer.
  %38 = load i32, %"(Array(String) | Dir | Dir::ChildIterator | Dir::EntryIterator | Path::PartIterator | String::LineIterator | Tuple(String) | Tuple(String, String, String) | Tuple(String, String, String, String))" %37, align 4, !dbg !18
GEP base pointer is not a vector or a vector of pointers
  %39 = getelementptr inbounds %"(Array(String) | Dir | Dir::ChildIterator | Dir::EntryIterator | Path::PartIterator | String::LineIterator | Tuple(String) | Tuple(String, String, String) | Tuple(String, String, String, String))", %"(Array(String) | Dir | Dir::ChildIterator | Dir::EntryIterator | Path::PartIterator | String::LineIterator | Tuple(String) | Tuple(String, String, String) | Tuple(String, String, String, String))" %36, i32 0, i32 1, !dbg !18
 (Exception)
  from [...]/bin/crystal in 'raise<Exception>:NoReturn'
  from [...]/bin/crystal in 'raise<String>:NoReturn'
  from [...]/bin/crystal in 'Crystal::Compiler#codegen<Crystal::Program, Crystal::ASTNode+, Array(Crystal::Compiler::Source), String>:(Tuple(Array(Crystal::Compiler::CompilationUnit), Array(String)) | Nil)'
  from [...]/bin/crystal in 'Crystal::Compiler#compile<Array(Crystal::Compiler::Source), String>:Crystal::Compiler::Result'
  from [...]/bin/crystal in 'Crystal::Command::run<Array(String)>:(Bool | Crystal::Repl::Value | Nil)'
  from [...]/bin/crystal in '__crystal_main'
  from [...]/bin/crystal in 'main'
Error: you've found a bug in the Crystal compiler. Please open an issue, including source code that will allow us to reproduce the bug: https://github.com/crystal-lang/crystal/issues
@stephannv stephannv added the kind:bug A bug in the code. Does not apply to documentation, specs, etc. label Sep 6, 2024
@devnote-dev
Copy link
Contributor

Seems to be another version of #13890.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc.
Projects
None yet
Development

No branches or pull requests

2 participants