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 compiler error: unexpected fault address for &^ assignment #1394

Closed
gopherbot opened this issue Jan 6, 2011 · 2 comments
Closed

Comments

@gopherbot
Copy link
Contributor

by snilsson@nada.kth.se:

1. What is a short input program that triggers the error?

package main

func main() {
    x := []uint{0}
    x[0] &^= f()
}

func f() uint {
    return 1<<31 // doesn't panic with 1<<31 - 1
}


2. What is the full compiler output?

unexpected fault address 0x80000000
throw: fault

panic PC=0x7f8721298048
runtime.throw+0x3b /home/sni/go/src/pkg/runtime/runtime.c:73
    runtime.throw(0x42385e, 0x80000000)
runtime.sigpanic+0xe7 /home/sni/go/src/pkg/runtime/linux/thread.c:288
    runtime.sigpanic()
main.main+0x69 /home/sni/Work/book/bitset/testAndNotAssignment.go:5
    main.main()
runtime.mainstart+0xf /home/sni/go/src/pkg/runtime/amd64/asm.s:77
    runtime.mainstart()
runtime.goexit /home/sni/go/src/pkg/runtime/proc.c:148
    runtime.goexit()


3. What version of the compiler are you using?  (Run it with the -V flag.)

6g version 7045+
@robpike
Copy link
Contributor

robpike commented Jan 6, 2011

Comment 1:

This is not an internal compiler error, just bad generated code. That is, the compiler
doesn't fault, the compiled program does.  However, this is a nice short example of the
bug; thanks for that.
Here's the generated code around the call to f(). Looks like BX is being used without
being saved.
0014 (x.go:5) MOVQ    (BX),BX
0015 (x.go:5) CALL    ,f+0(SB)
0016 (x.go:5) MOVL    (SP),R8
0017 (x.go:5) XORL    $-1,R8
0018 (x.go:5) ANDL    R8,(BX) // this instruction faults

Owner changed to k...@golang.org.

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Jan 6, 2011

Comment 2:

This issue was closed by revision 2281ca1.

Status changed to Fixed.

@gopherbot gopherbot added the fixed label Jan 6, 2011
@golang golang locked and limited conversation to collaborators Jun 24, 2016
@rsc rsc unassigned ken Jun 22, 2022
This issue was closed.
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

4 participants