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

Internal error in syntax error in example with floating point value #36670

Closed
matszpk opened this issue Jan 21, 2020 · 2 comments
Closed

Internal error in syntax error in example with floating point value #36670

matszpk opened this issue Jan 21, 2020 · 2 comments

Comments

@matszpk
Copy link

matszpk commented Jan 21, 2020

Error encountered while trial of building some trivial example:

package main

import "fmt"

type Ab struct {
    v float64
    i int
}

func main() {
    t := Ab{ 144&.0, 445 }
    fmt.Println(t)
}

Compiler (go clang 1.12.12) just prints following error:

# command-line-arguments
./internal-error.go:11:17: internal compiler error: binaryOp: bad operation: 144 & 0

Please file a bug report including a short program that triggers the error.
https://golang.org/issue/new

I reproduced this bug on a official version go 1.12.12 (clang). gccgo print correct error that describes syntax error:

./internal-error.go:11:17: error: expected integer type
   11 |     t := Ab{ 144&.0, 445 }
      |

Go version: go version go1.12.12 linux/amd64

GO env:

GOARCH="amd64"
GOBIN=""
GOCACHE="/mnt/oldsys/home/mat/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/mat/docs/dev/go/c00lpool-ws"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="/usr/bin/gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build945722657=/tmp/go-build -gno-record-gcc-switches"
@ALTree
Copy link
Member

ALTree commented Jan 21, 2020

Hi,

thanks for reporting this.

This is a dup of #31060, already fixed in 1.13 and on tip.

Closing here, since no further action is required.

@ALTree ALTree closed this as completed Jan 21, 2020
@ALTree
Copy link
Member

ALTree commented Jan 21, 2020

Compiler (go clang 1.12.12)

(and btw the official compiler is not based on clang). I assume you mean gc, the compiler distributed on golang.org.

@golang golang locked and limited conversation to collaborators Jan 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants