summaryrefslogtreecommitdiff
path: root/src/cmd/6l
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2013-09-10 14:53:41 -0400
committerRuss Cox <rsc@golang.org>2013-09-10 14:53:41 -0400
commitfd19b8850fdc7022e1f7d00afbaabf980b205a8b (patch)
tree872d29608740b84af5d792b53d901e1c0a30cd41 /src/cmd/6l
parentf0dc92d4e222209f0ff65c9f85f86f12b4700de3 (diff)
downloadgo-fd19b8850fdc7022e1f7d00afbaabf980b205a8b.tar.gz
cmd/6l, cmd/8l: fix MOVL MOVQ optab
The entry for LEAL/LEAQ in these optabs was listed as having two data bytes in the y array. In fact they had and expect no data bytes. However, the general loop expects to be able to look at at least one data byte, to make sure it is not 0x0f. So give them each a single data byte set to 0 (not 0x0f). Since the MOV instructions have the largest optab cases, this requires growing the size of the data array. Clang found this bug because the general o->op[z] == 0x0f test was using z == 22, which was out of bounds. In practice the next byte in memory was probably not 0x0f so it wasn't truly broken. But might as well be clean. Update issue 5764 R=ken2 CC=golang-dev https://codereview.appspot.com/13241050
Diffstat (limited to 'src/cmd/6l')
-rw-r--r--src/cmd/6l/l.h2
-rw-r--r--src/cmd/6l/optab.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/src/cmd/6l/l.h b/src/cmd/6l/l.h
index 265a6947e..ecab867e4 100644
--- a/src/cmd/6l/l.h
+++ b/src/cmd/6l/l.h
@@ -193,7 +193,7 @@ struct Optab
short as;
uchar* ytab;
uchar prefix;
- uchar op[22];
+ uchar op[23];
};
struct Movtab
{
diff --git a/src/cmd/6l/optab.c b/src/cmd/6l/optab.c
index c354967b9..46603ad45 100644
--- a/src/cmd/6l/optab.c
+++ b/src/cmd/6l/optab.c
@@ -913,7 +913,7 @@ Optab optab[] =
{ AMOVHLPS, yxr, Pm, 0x12 },
{ AMOVHPD, yxmov, Pe, 0x16,0x17 },
{ AMOVHPS, yxmov, Pm, 0x16,0x17 },
- { AMOVL, ymovl, Px, 0x89,0x8b,0x31,0xb8,0xc7,(00),0x6e,0x7e,Pe,0x6e,Pe,0x7e },
+ { AMOVL, ymovl, Px, 0x89,0x8b,0x31,0xb8,0xc7,(00),0x6e,0x7e,Pe,0x6e,Pe,0x7e,0 },
{ AMOVLHPS, yxr, Pm, 0x16 },
{ AMOVLPD, yxmov, Pe, 0x12,0x13 },
{ AMOVLPS, yxmov, Pm, 0x12,0x13 },
@@ -925,7 +925,7 @@ Optab optab[] =
{ AMOVNTPD, yxr_ml, Pe, 0x2b },
{ AMOVNTPS, yxr_ml, Pm, 0x2b },
{ AMOVNTQ, ymr_ml, Pm, 0xe7 },
- { AMOVQ, ymovq, Pw, 0x89, 0x8b, 0x31, 0xc7,(00), 0xb8, 0xc7,(00), 0x6f, 0x7f, 0x6e, 0x7e, Pf2,0xd6, Pf3,0x7e, Pe,0xd6, Pe,0x6e, Pe,0x7e },
+ { AMOVQ, ymovq, Pw, 0x89, 0x8b, 0x31, 0xc7,(00), 0xb8, 0xc7,(00), 0x6f, 0x7f, 0x6e, 0x7e, Pf2,0xd6, Pf3,0x7e, Pe,0xd6, Pe,0x6e, Pe,0x7e,0 },
{ AMOVQOZX, ymrxr, Pf3, 0xd6,0x7e },
{ AMOVSB, ynone, Pb, 0xa4 },
{ AMOVSD, yxmov, Pf2, 0x10,0x11 },
@@ -935,7 +935,7 @@ Optab optab[] =
{ AMOVSW, ynone, Pe, 0xa5 },
{ AMOVUPD, yxmov, Pe, 0x10,0x11 },
{ AMOVUPS, yxmov, Pm, 0x10,0x11 },
- { AMOVW, ymovw, Pe, 0x89,0x8b,0x31,0xb8,0xc7,(00) },
+ { AMOVW, ymovw, Pe, 0x89,0x8b,0x31,0xb8,0xc7,(00),0 },
{ AMOVWLSX, yml_rl, Pm, 0xbf },
{ AMOVWLZX, yml_rl, Pm, 0xb7 },
{ AMOVWQSX, yml_rl, Pw, 0x0f,0xbf },