Skip to content

cmd/compile: incorrect runtime panic on switch statement involving generic slice/map/func type #53635

@mdempsky

Description

@mdempsky

https://go.dev/play/p/4Wa1-HERtli?v=gotip

This program should run silently and exit with success.

With Go 1.18 and tip, it silently miscompiles as a program that raises a runtime panic instead.

Normally, I'm of the opinion that silent miscompilations are severe issues that merit a backport and fix. But I think this case is very unlikely in practice. If anyone disagrees or thinks there's an easy way to fix the 1.18 frontend to handle this correctly (or at least ICE instead), feel free to speak up.

/cc @randall77 @dr2chase @cuonglm

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions