Skip to content

cmd/compile: optimisations change the behaviour of *struct{} #8938

@ainar-g

Description

@ainar-g
What does 'go version' print?
go version go1.3.3 linux/amd64

What steps reproduce the problem?
If possible, include a link to a program on play.golang.org.

1. Get http://play.golang.org/p/mQAu2o6wEb.
2. Uncomment the Println before the if.
3. Run.

What happened?
When compiled as usual, this prints "Not Equals". But when compiled with
-gcflags '-N' it prints "Equals".

What should have happened instead?
It should have printed "Equals" in both cases, as it does when fmt.Println(a)
is commented, or if b is printed as well.

Please provide any additional information below.
The behaviour is the same on Go 1.2. The tip version (go version devel +fb3d6c1631c3 Wed
Oct 15 14:33:52 2014 -0400 linux/amd64) prints "Not Equals" both with
optimisations and without them.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions