Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/goPublic

Commitfc9a18f

Browse files
committed
[release-branch.go1.1] cmd/8g: Make clearfat non-interleaved with pointer calculations.
««« CL 11383043 / dc24634de6c5cmd/8g: Make clearfat non-interleaved with pointer calculations.clearfat (used to zero initialize structures) will use AX for x86 block ops. If we write to AX while calculating the dest pointer, we will fill the structure with incorrect values.Since 64-bit arithmetic uses AX to synthesize a 64-bit register, getting an adress by indexing with 64-bit ops can clobber the register.Fixes#5820.R=golang-dev, rscCC=golang-devhttps://golang.org/cl/11383043»»»Update#5928R=golang-dev, bradfitzCC=golang-devhttps://golang.org/cl/11698043
1 parentf2fa995 commitfc9a18f

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

‎src/cmd/8g/ggen.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ clearfat(Node *nl)
7878
c=w %4;// bytes
7979
q=w /4;// quads
8080

81-
gconreg(AMOVL,0,D_AX);
8281
nodreg(&n1,types[tptr],D_DI);
8382
agen(nl,&n1);
83+
gconreg(AMOVL,0,D_AX);
8484

8585
if(q >=4) {
8686
gconreg(AMOVL,q,D_CX);

‎test/fixedbugs/issue5820.go‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// run
2+
3+
// Copyright 2013 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 5820: register clobber when clearfat and 64 bit arithmetic is interleaved.
8+
9+
package main
10+
11+
funcmain() {
12+
array:=make([][]int,2)
13+
index:=uint64(1)
14+
array[index]=nil
15+
ifarray[1]!=nil {
16+
panic("array[1] != nil")
17+
}
18+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp