Skip to content

[AUTOMATED] Emit zero Go pointer-pair returns as record literals - #1817

Merged
mahaloz merged 1 commit into
mainfrom
automated/go-nil-selected-pointer-record
Nov 19, 2026
Merged

mahaloz merged 1 commit into
mainfrom
automated/go-nil-selected-pointer-record

Conversation

@mahaloz

@mahaloz mahaloz commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

[AUTOMATED] A declared Go interface-word pair can emit an invalid conversion on its nil return.

d=$(mktemp -d)
cat > "$d/main.go" <<'GO'
package main
type Reader interface{ Read() int }
type N int
func (n N) Read() int { return int(n) }
//go:noinline
func selectWords(r Reader, keep bool) Reader {
    if keep { return r }
    return nil
}
var result Reader
func main() { result = selectWords(N(9), true) }
GO
CGO_ENABLED=0 go build -trimpath -o "$d/pair" "$d/main.go"
kuna decompile "$d/pair" main.selectWords --language go --assert-strict \
  --assert 'typedef struct ReaderWords { void *tab; void *data; };' \
  --assert 'prototype main.selectWords ReaderWords selectWords(void *tab, void *data, bool keep)'
return ReaderWords(ZEXT816(0))
  • Emit ReaderWords{} for a proved all-zero return to the declared pointer pair.
  • Check the live table and payload, a nonzero carrier, and C output. The nil branch fails the new assertion on main.

Model: openai/gpt-6.2-sol

@mahaloz
mahaloz merged commit 00a2bc1 into main Nov 19, 2026
9 checks passed
@mahaloz
mahaloz deleted the automated/go-nil-selected-pointer-record branch November 19, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant