[go] cmd/compile/internal/ir: handle RHS = nil in static value

5 views
Skip to first unread message

Cuong Manh Le (Gerrit)

unread,
May 28, 2026, 4:24:56 AM (13 days ago) May 28
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Cuong Manh Le has uploaded the change for review

Commit message

cmd/compile/internal/ir: handle RHS = nil in static value

For #5370
Change-Id: I04ca4e38e5e4d54814eb5ec50e698d190c67a652

Change diff

diff --git a/src/cmd/compile/internal/ir/expr.go b/src/cmd/compile/internal/ir/expr.go
index 9b4577b..b5ab950 100644
--- a/src/cmd/compile/internal/ir/expr.go
+++ b/src/cmd/compile/internal/ir/expr.go
@@ -916,16 +916,19 @@
return nil
}

+ var lhs Node
var rhs Node
FindRHS:
switch defn.Op() {
case OAS:
defn := defn.(*AssignStmt)
+ lhs = defn.X
rhs = defn.Y
case OAS2:
defn := defn.(*AssignListStmt)
for i, lhs := range defn.Lhs {
if lhs == n {
+ lhs = defn.Lhs[i]
rhs = defn.Rhs[i]
break FindRHS
}
@@ -935,6 +938,9 @@
return nil
}
if rhs == nil {
+ if name, ok := lhs.(*Name); ok && name.AutoTemp() {
+ return nil
+ }
base.FatalfAt(defn.Pos(), "RHS is nil: %v", defn)
}

diff --git a/src/cmd/compile/internal/ir/reassignment.go b/src/cmd/compile/internal/ir/reassignment.go
index ff3d08c..97c55e4 100644
--- a/src/cmd/compile/internal/ir/reassignment.go
+++ b/src/cmd/compile/internal/ir/reassignment.go
@@ -202,16 +202,19 @@
return nil
}

+ var lhs Node
var rhs Node
FindRHS:
switch defn.Op() {
case OAS:
defn := defn.(*AssignStmt)
+ lhs = defn.X
rhs = defn.Y
case OAS2:
defn := defn.(*AssignListStmt)
for i, lhs := range defn.Lhs {
if lhs == n {
+ lhs = defn.Lhs[i]
rhs = defn.Rhs[i]
break FindRHS
}
@@ -221,6 +224,9 @@
return nil
}
if rhs == nil {
+ if name, ok := lhs.(*Name); ok && name.AutoTemp() {
+ return nil
+ }
base.FatalfAt(defn.Pos(), "RHS is nil: %v", defn)
}

Change information

Files:
  • M src/cmd/compile/internal/ir/expr.go
  • M src/cmd/compile/internal/ir/reassignment.go
Change size: S
Delta: 2 files changed, 12 insertions(+), 0 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I04ca4e38e5e4d54814eb5ec50e698d190c67a652
Gerrit-Change-Number: 784280
Gerrit-PatchSet: 1
Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Cuong Manh Le (Gerrit)

unread,
May 28, 2026, 4:25:22 AM (13 days ago) May 28
to goph...@pubsubhelper.golang.org, Keith Randall, t hepudds, golang-co...@googlegroups.com
Attention needed from Keith Randall and t hepudds

Cuong Manh Le voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Keith Randall
  • t hepudds
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: I04ca4e38e5e4d54814eb5ec50e698d190c67a652
Gerrit-Change-Number: 784280
Gerrit-PatchSet: 1
Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
Gerrit-Reviewer: Keith Randall <k...@golang.org>
Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
Gerrit-Attention: Keith Randall <k...@golang.org>
Gerrit-Attention: t hepudds <thepud...@gmail.com>
Gerrit-Comment-Date: Thu, 28 May 2026 08:25:14 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Keith Randall (Gerrit)

unread,
May 29, 2026, 12:35:41 PM (12 days ago) May 29
to Cuong Manh Le, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Keith Randall, t hepudds, golang-co...@googlegroups.com
Attention needed from Cuong Manh Le and t hepudds

Keith Randall added 1 comment

File src/cmd/compile/internal/ir/expr.go
Line 919, Patchset 1 (Latest): var lhs Node
Keith Randall . unresolved

Won't `lhs` always be `n`?

Open in Gerrit

Related details

Attention is currently required from:
  • Cuong Manh Le
  • t hepudds
Submit Requirements:
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedNo-Wait-Release
    • requirement is not satisfiedReview-Enforcement
    • requirement satisfiedTryBots-Pass
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: go
    Gerrit-Branch: master
    Gerrit-Change-Id: I04ca4e38e5e4d54814eb5ec50e698d190c67a652
    Gerrit-Change-Number: 784280
    Gerrit-PatchSet: 1
    Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Reviewer: Keith Randall <k...@golang.org>
    Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
    Gerrit-Attention: t hepudds <thepud...@gmail.com>
    Gerrit-Attention: Cuong Manh Le <cuong.m...@gmail.com>
    Gerrit-Comment-Date: Fri, 29 May 2026 16:35:36 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    unsatisfied_requirement
    satisfied_requirement
    open
    diffy

    Cuong Manh Le (Gerrit)

    unread,
    May 29, 2026, 7:31:57 PM (11 days ago) May 29
    to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
    Attention needed from Cuong Manh Le and t hepudds

    Cuong Manh Le uploaded new patchset

    Cuong Manh Le uploaded patch set #2 to this change.
    Following approvals got outdated and were removed:
    Open in Gerrit

    Related details

    Attention is currently required from:
    • Cuong Manh Le
    • t hepudds
    Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedNo-Wait-Release
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: newpatchset
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I04ca4e38e5e4d54814eb5ec50e698d190c67a652
      Gerrit-Change-Number: 784280
      Gerrit-PatchSet: 2
      unsatisfied_requirement
      open
      diffy

      Cuong Manh Le (Gerrit)

      unread,
      May 29, 2026, 7:32:29 PM (11 days ago) May 29
      to goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Keith Randall, t hepudds, golang-co...@googlegroups.com
      Attention needed from t hepudds

      Cuong Manh Le voted

      Auto-Submit+1
      Commit-Queue+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • t hepudds
      Submit Requirements:
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement is not satisfiedNo-Wait-Release
      • requirement is not satisfiedReview-Enforcement
      • requirement is not satisfiedTryBots-Pass
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: go
      Gerrit-Branch: master
      Gerrit-Change-Id: I04ca4e38e5e4d54814eb5ec50e698d190c67a652
      Gerrit-Change-Number: 784280
      Gerrit-PatchSet: 2
      Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
      Gerrit-Reviewer: Keith Randall <k...@golang.org>
      Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
      Gerrit-Attention: t hepudds <thepud...@gmail.com>
      Gerrit-Comment-Date: Fri, 29 May 2026 23:32:21 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      unsatisfied_requirement
      open
      diffy

      Cuong Manh Le (Gerrit)

      unread,
      May 29, 2026, 7:32:44 PM (11 days ago) May 29
      to goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, Keith Randall, t hepudds, golang-co...@googlegroups.com
      Attention needed from Keith Randall and t hepudds

      Cuong Manh Le added 1 comment

      File src/cmd/compile/internal/ir/expr.go
      Line 919, Patchset 1: var lhs Node
      Keith Randall . resolved

      Won't `lhs` always be `n`?

      Cuong Manh Le

      Acknowledged

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Keith Randall
      • t hepudds
      Submit Requirements:
        • requirement is not satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedNo-Wait-Release
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I04ca4e38e5e4d54814eb5ec50e698d190c67a652
        Gerrit-Change-Number: 784280
        Gerrit-PatchSet: 2
        Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
        Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
        Gerrit-Reviewer: Keith Randall <k...@golang.org>
        Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
        Gerrit-Attention: Keith Randall <k...@golang.org>
        Gerrit-Attention: t hepudds <thepud...@gmail.com>
        Gerrit-Comment-Date: Fri, 29 May 2026 23:32:37 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Keith Randall <k...@golang.org>
        unsatisfied_requirement
        satisfied_requirement
        open
        diffy

        Keith Randall (Gerrit)

        unread,
        Jun 8, 2026, 6:46:58 PM (2 days ago) Jun 8
        to Cuong Manh Le, goph...@pubsubhelper.golang.org, Keith Randall, golang...@luci-project-accounts.iam.gserviceaccount.com, t hepudds, golang-co...@googlegroups.com
        Attention needed from Cuong Manh Le and t hepudds

        Keith Randall voted Code-Review+2

        Code-Review+2
        Open in Gerrit

        Related details

        Attention is currently required from:
        • Cuong Manh Le
        • t hepudds
        Submit Requirements:
        • requirement satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedNo-Wait-Release
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I04ca4e38e5e4d54814eb5ec50e698d190c67a652
        Gerrit-Change-Number: 784280
        Gerrit-PatchSet: 4
        Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
        Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
        Gerrit-Reviewer: Keith Randall <k...@golang.org>
        Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
        Gerrit-Attention: t hepudds <thepud...@gmail.com>
        Gerrit-Attention: Cuong Manh Le <cuong.m...@gmail.com>
        Gerrit-Comment-Date: Mon, 08 Jun 2026 22:46:53 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Cuong Manh Le (Gerrit)

        unread,
        3:38 AM (2 hours ago) 3:38 AM
        to goph...@pubsubhelper.golang.org, Keith Randall, golang...@luci-project-accounts.iam.gserviceaccount.com, t hepudds, golang-co...@googlegroups.com
        Attention needed from t hepudds

        Cuong Manh Le voted

        Auto-Submit+1
        Commit-Queue+1
        Open in Gerrit

        Related details

        Attention is currently required from:
        • t hepudds
        Submit Requirements:
        • requirement satisfiedCode-Review
        • requirement satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedNo-Wait-Release
        • requirement is not satisfiedReview-Enforcement
        • requirement is not satisfiedTryBots-Pass
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: go
        Gerrit-Branch: master
        Gerrit-Change-Id: I04ca4e38e5e4d54814eb5ec50e698d190c67a652
        Gerrit-Change-Number: 784280
        Gerrit-PatchSet: 5
        Gerrit-Owner: Cuong Manh Le <cuong.m...@gmail.com>
        Gerrit-Reviewer: Cuong Manh Le <cuong.m...@gmail.com>
        Gerrit-Reviewer: Keith Randall <k...@golang.org>
        Gerrit-Reviewer: t hepudds <thepud...@gmail.com>
        Gerrit-Attention: t hepudds <thepud...@gmail.com>
        Gerrit-Comment-Date: Wed, 10 Jun 2026 07:38:50 +0000
        Gerrit-HasComments: No
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy
        Reply all
        Reply to author
        Forward
        0 new messages