Skip to content

cmd/compile: ICE on arm64 due to missed constant folding #73200

@randall77

Description

@randall77
package main

var g bool

func main() {
	l_4 := uint32(0x6E54EE87)
	v4 := int8(-Int64FromInt64(1))
	g = int32(v4) >= safe_mod_func_int32_t_s_s(BoolInt32(l_4 >= 1), 7)
}

func safe_mod_func_int32_t_s_s(si1 int32, si2 int32) (r int32) {
	var v1 int32
	if si2 == 0 {
		v1 = si1
	} else {
		v1 = si1 % si2
	}
	return v1
}

func Int64FromInt64(n int64) int64 {
	return n
}

func BoolInt32(b bool) int32 {
	if b {
		return 1
	}
	return 0
}

Causes the compiler to crash with

internal compiler error: 'main': FlagConstant op should never make it to codegen v30 = FlagConstant <flags>[N=false,Z=false,C=false,V=false]

Metadata

Metadata

Assignees

Labels

BugReportIssues describing a possible bug in the Go implementation.FixPendingIssues that have a fix which has not yet been reviewed or submitted.FrozenDueToAgearch-arm64compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions