Skip to content

cmd/compile: gccgo error: incompatible types in binary expression #51475

@ddaa2000

Description

@ddaa2000

What version of Go are you using (go version)?

$ go version
go version go1.17.8 linux/amd64
$ gccgo --version
gccgo (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Does this issue reproduce with the latest release?

It is produced by gccgo, I'm not sure.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ddaa/.cache/go-build"
GOENV="/home/ddaa/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/ddaa/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/ddaa/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.17.8"
GCCGO="/usr/bin/gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/ddaa/Desktop/bugReview/go.mod"
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-build3532773105=/tmp/go-build -gno-record-gcc-switches"

What did you do?

$go build --compiler=gccgo
package main

type T11 bool

func main() {
	var V55 T11 = false
	if (true && true) && V55 {
	}
}

What did you expect to see?

go build successfully just as using gc compiler.
Actually if replace

if (true && true) && V55

with

if true && V55

It will compile successfully even using gccgo.

What did you see instead?

#bugReview
./main.go:8:20: error: incompatible types in binary expression
    8 |  if (true && true) && V55 {
      |        

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions