Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
78c8dec9
Commit
78c8dec9
authored
Jun 24, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug miscalculating ullman
in CALLMETH/DOTMETH SVN=124321
parent
d4c2da40
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
20 deletions
+17
-20
cgen.c
src/cmd/6g/cgen.c
+10
-6
gen.c
src/cmd/6g/gen.c
+3
-5
subr.c
src/cmd/gc/subr.c
+2
-0
walk.c
src/cmd/gc/walk.c
+2
-9
No files found.
src/cmd/6g/cgen.c
View file @
78c8dec9
...
...
@@ -19,20 +19,23 @@ cgen(Node *n, Node *res)
}
if
(
n
==
N
||
n
->
type
==
T
)
return
;
lno
=
dynlineno
;
if
(
n
->
op
!=
ONAME
)
dynlineno
=
n
->
lineno
;
// for diagnostics
if
(
res
==
N
||
res
->
type
==
T
)
fatal
(
"cgen: res nil"
);
if
(
n
->
ullman
>=
UINF
)
{
if
(
n
->
op
==
OINDREG
)
fatal
(
"cgen: this is going to misscompile"
);
if
(
res
->
ullman
>=
UINF
)
fatal
(
"cgen: fun both sides"
);
if
(
res
->
ullman
>=
UINF
)
{
dump
(
"fncalls"
,
n
);
fatal
(
"cgen: node and result functions"
);
}
}
lno
=
dynlineno
;
if
(
n
->
op
!=
ONAME
)
dynlineno
=
n
->
lineno
;
// for diagnostics
if
(
isfat
(
n
->
type
))
{
sgen
(
n
,
res
,
n
->
type
->
width
);
goto
ret
;
...
...
@@ -62,6 +65,7 @@ cgen(Node *n, Node *res)
nr
=
n
->
right
;
if
(
nl
!=
N
&&
nl
->
ullman
>=
UINF
)
if
(
nr
!=
N
&&
nr
->
ullman
>=
UINF
)
{
dump
(
"fncalls"
,
n
);
fatal
(
"cgen: both sides functions"
);
goto
ret
;
}
...
...
src/cmd/6g/gen.c
View file @
78c8dec9
...
...
@@ -658,7 +658,7 @@ cgen_callret(Node *n, Node *res)
fp
=
structfirst
(
&
flist
,
getoutarg
(
t
));
if
(
fp
==
T
)
fatal
(
"cgen_
a
ret: nil"
);
fatal
(
"cgen_
call
ret: nil"
);
memset
(
&
nod
,
0
,
sizeof
(
nod
));
nod
.
op
=
OINDREG
;
...
...
@@ -677,16 +677,14 @@ cgen_aret(Node *n, Node *res)
Type
*
fp
,
*
t
;
Iter
flist
;
fatal
(
"cgen_aret"
);
t
=
n
->
left
->
type
;
if
(
t
->
etype
==
TPTR32
||
t
->
etype
==
TPTR64
)
if
(
isptr
[
t
->
etype
]
)
t
=
t
->
type
;
fp
=
structfirst
(
&
flist
,
getoutarg
(
t
));
if
(
fp
==
T
)
fatal
(
"cgen_aret: nil"
);
/* gins LEA */
memset
(
&
nod1
,
0
,
sizeof
(
nod1
));
nod1
.
op
=
OINDREG
;
nod1
.
val
.
vval
=
D_SP
;
...
...
src/cmd/gc/subr.c
View file @
78c8dec9
...
...
@@ -1516,6 +1516,8 @@ ullmancalc(Node *n)
case
OI2S
:
case
OI2I
:
case
OCALL
:
case
OCALLMETH
:
case
OCALLINTER
:
ul
=
UINF
;
goto
out
;
}
...
...
src/cmd/gc/walk.c
View file @
78c8dec9
...
...
@@ -76,7 +76,6 @@ loop:
if
(
top
!=
Erv
)
goto
nottop
;
n
->
addable
=
1
;
ullmancalc
(
n
);
goto
ret
;
case
ONONAME
:
...
...
@@ -94,7 +93,6 @@ loop:
if
(
top
==
Etop
)
goto
nottop
;
n
->
addable
=
1
;
ullmancalc
(
n
);
if
(
n
->
type
==
T
)
{
s
=
n
->
sym
;
if
(
s
->
undef
==
0
)
{
...
...
@@ -163,14 +161,12 @@ loop:
if
(
top
==
Elv
)
goto
nottop
;
n
->
ullman
=
UINF
;
if
(
n
->
type
!=
T
)
goto
ret
;
walktype
(
n
->
left
,
Erv
);
if
(
n
->
left
==
N
)
goto
ret
;
t
=
n
->
left
->
type
;
if
(
t
==
T
)
goto
ret
;
...
...
@@ -210,14 +206,12 @@ loop:
break
;
case
OCALLMETH
:
// add this-pointer to the arg list
// this is bad - if not a simple
// should make a temp copy rather
// than recalculate it.
l
=
ascompatte
(
n
->
op
,
getinarg
(
t
),
&
n
->
right
,
0
);
r
=
ascompatte
(
n
->
op
,
getthis
(
t
),
&
n
->
left
->
left
,
0
);
if
(
l
!=
N
)
r
=
nod
(
OLIST
,
r
,
l
);
n
->
left
->
left
=
N
;
ullmancalc
(
n
->
left
);
n
->
right
=
reorder1
(
r
);
break
;
}
...
...
@@ -442,7 +436,6 @@ loop:
if
(
n
->
left
==
N
)
goto
ret
;
evconst
(
n
);
ullmancalc
(
n
);
if
(
n
->
op
==
OLITERAL
)
goto
ret
;
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment