Skip to content

builtin println pointer formatting differs from Go #1557

@luoliwoshang

Description

@luoliwoshang

Summary

println in llgo prints nil pointers as (nil) (via C %p), while Go prints 0x0. This causes test mismatches in TestRunFromTestgo / reader (and similar cases like invoke/struczero/tpmethod).

Repro (example: TestRunFromTestgo / reader)

root@a5b720ceb938:~/llgo/cl/_testgo/reader# go run in.go
hello world (0x0,0x0)
root@a5b720ceb938:~/llgo/cl/_testgo/reader# llgo run in.go
hello world ((nil),(nil))

Expected

hello world (0x0,0x0)

Actual

hello world ((nil),(nil))

Suspected root cause

runtime/internal/runtime/z_print.go uses C fprintf("%p"), which prints (nil) for null pointers on glibc.

Environment

  • OS: Linux
  • Arch: arm64
  • Go toolchain: 1.24.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions