You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mojo: /__w/modular/modular/KGEN/lib/MojoParser/ExprEmitter.cpp:769: M::KGEN::LIT::SRValue M::KGEN::LIT::ExprEmitter::emitSRValue(ASTExprAnd<M::KGEN::LIT::AnyValue>, M::KGEN::LIT::ExprContext, M::KGEN::LIT::ASTType): Assertion `pValue && "must be PValue if register-passable and not SRValue"' failed.
Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes.
Stack dump:
0. Program arguments: mojo repro.mojo
1. Crash resolving decl body at loc(".../repro.mojo":16:1)
>> fn foo(owned v: DynamicVector[Wrapper]):
^.......................................
>> v[0].n.x = 0
................<
2. Crash parsing statement at loc(".../repro.mojo":17:5)
>> v[0].n.x = 0
^...........<
I think @value and @register_passable are not compatible each other, since @register_passable requires different style of constructors than what @value would added.
A workaround might be using @register_passable("trivial").
(Indeed, the crash persists even with @register_passable("trivial"). Please disregard my suggestion.)
So, while playing around with @register_passable, I discovered #1579.
I modified the snippet such that the required constructors are specified manually, the way @register_passable requires them to be (based on the compiler error messages), and v[0].n.x = 0 still causes a crash.
mojo: /__w/modular/modular/KGEN/lib/MojoParser/ExprEmitter.cpp:769: M::KGEN::LIT::SRValue M::KGEN::LIT::ExprEmitter::emitSRValue(ASTExprAnd<M::KGEN::LIT::AnyValue>, M::KGEN::LIT::ExprContext, M::KGEN::LIT::ASTType): Assertion `pValue && "must be PValue if register-passable and not SRValue"' failed.
Adding @register_passable("trivial") still results in the same crash regardless of whether @value is present or not.
mojo: /__w/modular/modular/KGEN/lib/MojoParser/ExprEmitter.cpp:769: M::KGEN::LIT::SRValue M::KGEN::LIT::ExprEmitter::emitSRValue(ASTExprAnd<M::KGEN::LIT::AnyValue>, M::KGEN::LIT::ExprContext, M::KGEN::LIT::ASTType): Assertion `pValue && "must be PValue if register-passable and not SRValue"' failed.
Bug description
The following snippet crashes during parsing/sema.
Steps to reproduce
System information
The text was updated successfully, but these errors were encountered: