Dave Cheney | 54e8d50 | 2012-12-06 08:01:33 +1100 | [diff] [blame] | 1 | // run |
| 2 | |
| 3 | // Copyright 2012 The Go Authors. All rights reserved. |
| 4 | // Use of this source code is governed by a BSD-style |
| 5 | // license that can be found in the LICENSE file. |
| 6 | |
| 7 | // Issue 4396. Arrays of bytes are not required to be |
| 8 | // word aligned. 5g should use MOVB to load the address |
| 9 | // of s.g[0] for its nil check. |
| 10 | // |
| 11 | // This test _may_ fail on arm, but requires the host to |
| 12 | // trap unaligned loads. This is generally done with |
| 13 | // |
| 14 | // echo "4" > /proc/cpu/alignment |
| 15 | |
| 16 | package main |
| 17 | |
| 18 | var s = struct { |
| 19 | // based on lzw.decoder |
| 20 | a, b, c, d, e uint16 |
| 21 | f [4096]uint8 |
| 22 | g [4096]uint8 |
| 23 | }{} |
| 24 | |
| 25 | func main() { |
| 26 | s.g[0] = 1 |
| 27 | } |