compiler bug?

175 views
Skip to first unread message

Dan Kortschak

unread,
Sep 18, 2015, 12:01:20 AM9/18/15
to golang-nuts
I have just noticed a weird set of go1.5.1 errors from code that compiles with 1.4:

$ go get github.com/biogo/examples/krishna
# github.com/biogo/examples/krishna
../../../examples/krishna/krishna.go:21: invalid operation: 1 << (uint(pals.filterParams·3.WordSize) * 2) (shift of type float64)
../../../examples/krishna/krishna.go:222: tempname called with nil type
../../../examples/krishna/krishna.go:222: cannot use autotmp_0166 (type int32) as type float64 in assignment


The actual code in the first (21) error is (in
github.com/biogo/align/pals/pals.go +211):

func (p *PALS) AvgIndexListLength(filterParams *filter.Params) float64 {
return float64(p.target.Len()) / float64(int(1)<<(uint(filterParams.WordSize)*2))
}

It looks like the int is being ignored in the shift in this case

It's not clear where the error at 222 is coming from since there is no
context.


It would also be nice if the errors were a little more informative -
krishna.go +21 is an import statement and krishna.go +222 is a call to
the pals method above.



thanks
Dan

Brad Fitzpatrick

unread,
Sep 18, 2015, 12:21:22 PM9/18/15
to Dan Kortschak, golang-nuts
I see you filed a bug (https://github.com/golang/go/issues/12677). We can move discussion there.


Dan

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages