-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorcompiler:loweringSyntax lowering (compiler front end, 2nd stage)Syntax lowering (compiler front end, 2nd stage)
Description
Discussed a bit at #60733 (comment)
julia> (q,r,s)=1,1,1 # just to prevent UndefVarError, though I'm not sure that should happen either
(1, 1, 1)
julia> (q,r,s)::Tuple = (1,2,3)
(1, 2, 3)
julia> ((q,r),s)::Tuple = ((1,2),3)
[65584] signal 11 (2): Segmentation fault: 11
julia> Meta.@lower ((q,r),s)::Tuple = ((1,2),3)
:($(Expr(:thunk, CodeInfo(
1 ─ %1 = Main.q
│ %2 = Main.r
│ builtin Core.tuple(%1, %2)
│ %4 = Main.s
│ %5 = builtin Core.tuple(%8, %4) # <- can't access %8
│ %6 = Main.Tuple
│ builtin Core.typeassert(%5, %6)
│ %8 = builtin Core.tuple(1, 2)
│ builtin Core.declare_global(Main, :s, true)
│ $(Expr(:latestworld))
│ %11 = builtin Core.get_binding_type(Main, :s)
│ #s3 = 3
│ %13 = #s3
│ %14 = builtin %13 isa %11
└── goto #3 if not %14
2 ─ goto #4
3 ─ %17 = #s3
└── #s3 = Base.convert(%11, %17)
4 ┄ %19 = #s3
│ builtin Core.setglobal!(Main, :s, %19)
│ %21 = builtin Core.tuple(%8, 3)
└── return %21
))))
Found while writing the AST validator; not sure if I should consider it valid syntax (and fix lowering) or consider it invalid (and protect lowering from this) given how many versions of julia it fails on
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorcompiler:loweringSyntax lowering (compiler front end, 2nd stage)Syntax lowering (compiler front end, 2nd stage)