Skip to content

cmd/compile: constants in -S output for arm64 have extra high bits set #53551

@randall77

Description

@randall77
package main

func f(x *int8) bool {
	return *x <= 43
}

Compiling this program with -S for arm64 has the line:

CMPW	$184683593771, R1

It should be

CMPW	$43, R1

Note that 184683593771 = 43<<32 + 43.
Go 1.16 is ok, this started in Go 1.17. Bisect points to https://go-review.googlesource.com/c/go/+/289649 . It looks maybe intentional? Not sure, but definitely weird.

The actual machine code looks correct. Builders are passing, and go tool objdump shows the right disassembly. It's just the -S output that appears broken.

@cherrymui @erifan

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions