Skip to content

runtime/race: race detector truncates command-line arguments on ppc64le #43883

Open
@mdempsky

Description

@mdempsky

When the program below is run with the race detector enabled, it truncates the command-line arguments list at the "" argument. In particular, this prevents using a race-detector-enabled cmd/compile on ppc64le, because cmd/go typically passes -D "".

I only see this on linux/ppc64le. I'm not able to reproduce the issue on linux/amd64.

$ go run hi.go -- one two "" three four
["/tmp/go-build2867456842/b001/exe/hi" "--" "one" "two" "" "three" "four"]
["one" "two" "" "three" "four"]

$ go run -race hi.go -- one two "" three four
["/tmp/go-build2206806436/b001/exe/hi" "--" "one" "two"]
["one" "two"]
package main

import (
	"flag"
	"fmt"
	"os"
)

func main() {
	fmt.Printf("%q\n", os.Args)
	flag.Parse()
	fmt.Printf("%q\n", flag.Args())
}

/cc @dvyukov

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    Status

    Triage Backlog

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions