Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: println compiles to nothing #21808

Closed
randall77 opened this issue Sep 8, 2017 · 4 comments

Comments

Projects
None yet
3 participants
@randall77
Copy link
Contributor

commented Sep 8, 2017

At tip,

package main

import "fmt"

func main() {
	fmt.Printf("A\n")
	println()
	fmt.Printf("B\n")
}

Should print

A

B

Instead prints

A
B

Looks like println is getting compiled to nothing. Or at least, nothing that prints. Looking at the assembly there is a printlock/printunlock pair, but nothing in between.
Doesn't seem to affect any release, so labeling 1.10.

@randall77 randall77 added this to the Go1.10 milestone Sep 8, 2017

@odeke-em

This comment has been minimized.

Copy link
Member

commented Sep 8, 2017

@randall77 I can confirm that CL https://go-review.googlesource.com/c/go/+/55097 is the one that changed this behavior.

@randall77

This comment has been minimized.

Copy link
Contributor Author

commented Sep 8, 2017

@odeke-em Thanks, that helps a lot.

@randall77 randall77 self-assigned this Sep 8, 2017

@gopherbot

This comment has been minimized.

Copy link

commented Sep 8, 2017

Change https://golang.org/cl/62390 mentions this issue: cmd/compile: fix println()

@gopherbot gopherbot closed this in 02deb77 Sep 8, 2017

@gopherbot

This comment has been minimized.

Copy link

commented Sep 8, 2017

Change https://golang.org/cl/62430 mentions this issue: cmd/compile: slightly more idiomatic println code

gopherbot pushed a commit that referenced this issue Sep 8, 2017

cmd/compile: slightly more idiomatic println code
Updates #21808.

Change-Id: I0314426afcfeed17b1111040110d7f2b0e209526
Reviewed-on: https://go-review.googlesource.com/62430
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

@golang golang locked and limited conversation to collaborators Sep 8, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.