http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60134
Bug ID: 60134 Summary: runtime_unmarkspan panics with "unaligned pointer" Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: go Assignee: ian at airs dot com Reporter: vogt at linux dot vnet.ibm.com (using git commit id e63988cca99cbbf6e5c459379309fe3359fe7c09) The test case convert.go fails with a panic in a panic on System/z: -- snip -- fatal error: markspan: unaligned pointer goroutine 1 [running]: runtime_dopanic ../../../libgo/runtime/panic.c:77 runtime_throw ../../../libgo/runtime/panic.c:115 runtime_unmarkspan ../../../libgo/runtime/mgc0.c:2452 __go_free ../../../libgo/runtime/malloc.goc:240 __go_panic ../../../libgo/runtime/go-panic.c:106 runtime_panicstring ../../../libgo/runtime/panic.c:134 __go_map_index ../../../libgo/runtime/go-map-index.c:92 reflect.canonicalize ../../../libgo/go/reflect/type.go:1782 reflect.toType ../../../libgo/go/reflect/type.go:1791 reflect.TypeOf ../../../libgo/go/reflect/type.go:1026 fmt..import ../../../libgo/go/fmt/print.go:643 __go_init_main /home/vogt/src/git/gcc/gcc/testsuite/go.test/test/convert.go:9 runtime_main ../../../libgo/runtime/proc.c:555 kickoff ../../../libgo/runtime/proc.c:232 -- snip -- It turns out that mgc0.c:runtime_unmarkspan() is called with a pointer that should be 16 byte aligned (wordsPerBitmapWord) but is actually only 8 byte aligned. The original pointer points to the stack variable "Defer d" in proc.c:runtime_main(). I guess the code should somehow enforce that "Defer d" is aligned to mgc0.c:wordsPerBitmapWord bytes, although I'm not sure about the right way to fix this. Note: Even though adding "__attribute__ ((align(16)))" for d fixes the problem for me, the test case still fails, but that is another issue that may or may not be platform specific. In any case I'll look into that and open another bug report if necessary.