[go] cmd/compile: fix misscompile in rewrite generic rules

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Jun 30, 2026, 1:06:58 PM (yesterday) Jun 30
to Jorropo, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Junyang Shao, Keith Randall, Keith Randall, golang...@luci-project-accounts.iam.gserviceaccount.com, Martin Möhrmann, golang-co...@googlegroups.com

Gopher Robot submitted the change

Change information

Commit message:
cmd/compile: fix misscompile in rewrite generic rules

We canonicalize *sh*x(32|16|8) x (Const*) to *sh*x64 x (Const64)
however for the shift type we were using the shift's type.

This is wrong since if we have let's say Rsh32x32 <uint32>
we would generate a Const64 with a type size of 4 (given it
takes the uint32 type).

This causes me confirmed crashes, maybe misscompilations too but
I didn't tried coming up with one.
Change-Id: Idcef7a371836524aa6649e13424431d716497860
Auto-Submit: Jorropo <jorro...@gmail.com>
Auto-Submit: Junyang Shao <shaoj...@google.com>
Reviewed-by: Keith Randall <k...@golang.org>
Reviewed-by: Keith Randall <k...@google.com>
Reviewed-by: Junyang Shao <shaoj...@google.com>
Files:
  • M src/cmd/compile/internal/ssa/_gen/generic.rules
  • M src/cmd/compile/internal/ssa/rewritegeneric.go
Change size: L
Delta: 2 files changed, 144 insertions(+), 180 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Idcef7a371836524aa6649e13424431d716497860
Gerrit-Change-Number: 795240
Gerrit-PatchSet: 5
Gerrit-Owner: Jorropo <jorro...@gmail.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Jorropo <jorro...@gmail.com>
Gerrit-Reviewer: Junyang Shao <shaoj...@google.com>
Gerrit-Reviewer: Keith Randall <k...@golang.org>
Gerrit-Reviewer: Keith Randall <k...@google.com>
Gerrit-Reviewer: Martin Möhrmann <moeh...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages