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

Codegen bug with duplicate ivar declaration and inheriting from generic instance type #15338

Open
straight-shoota opened this issue Jan 12, 2025 · 1 comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:codegen

Comments

@straight-shoota
Copy link
Member

The following code crashes the compiler in codegen:

module M
  @x = ""
end

class A
  @x = ""
end

class B(T) < A
  include M
end

class C < B(UInt64)
  @y = ""
end

C.new
Module validation failed: Invalid indices for GEP pointer type!
  %3 = getelementptr inbounds %C, ptr %0, i32 0, i32 3, !dbg !8
 (Exception)
@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:compiler:codegen labels Jan 12, 2025
@ysbaddaden
Copy link
Contributor

I'd wager the generics are confusing the compiler to believe there are 3 ivars (@x, @x and @y) while codegen will merge both @x when generating the struct aggregate.

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. topic:compiler:codegen
Projects
None yet
Development

No branches or pull requests

2 participants