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
18890eeb
Commit
18890eeb
authored
May 27, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug154; tweak bug153 exit status
R=ken OCL=29448 CL=29448
parent
5f460b38
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
13 deletions
+11
-13
const.c
src/cmd/gc/const.c
+11
-6
bug154.go
test/fixedbugs/bug154.go
+0
-0
golden.out
test/golden.out
+0
-7
No files found.
src/cmd/gc/const.c
View file @
18890eeb
...
...
@@ -13,16 +13,20 @@ static Val copyval(Val);
/*
* truncate float literal fv to 32-bit or 64-bit precision
* according to type.
* according to type
; return truncated value
.
*/
void
truncfltlit
(
Mpflt
*
f
v
,
Type
*
t
)
Mpflt
*
truncfltlit
(
Mpflt
*
old
v
,
Type
*
t
)
{
double
d
;
float
f
;
Mpflt
*
fv
;
if
(
t
==
T
)
return
;
return
oldv
;
fv
=
mal
(
sizeof
*
fv
);
*
fv
=
*
oldv
;
// convert large precision literal floating
// into limited precision (float64 or float32)
...
...
@@ -41,6 +45,7 @@ truncfltlit(Mpflt *fv, Type *t)
mpmovecflt
(
fv
,
d
);
break
;
}
return
fv
;
}
/*
...
...
@@ -154,7 +159,7 @@ convlit1(Node *n, Type *t, int explicit)
else
if
(
ct
!=
CTFLT
)
goto
bad
;
overflow
(
n
->
val
,
t
);
truncfltlit
(
n
->
val
.
u
.
fval
,
t
);
n
->
val
.
u
.
fval
=
truncfltlit
(
n
->
val
.
u
.
fval
,
t
);
}
else
if
(
et
==
TSTRING
&&
ct
==
CTINT
&&
explicit
)
n
->
val
=
tostr
(
n
->
val
);
else
...
...
@@ -607,7 +612,7 @@ ret:
// truncate precision for non-ideal float.
if
(
v
.
ctype
==
CTFLT
&&
n
->
type
->
etype
!=
TIDEAL
)
truncfltlit
(
v
.
u
.
fval
,
n
->
type
);
n
->
val
.
u
.
fval
=
truncfltlit
(
v
.
u
.
fval
,
n
->
type
);
return
;
settrue:
...
...
test/bugs/bug154.go
→
test/
fixed
bugs/bug154.go
View file @
18890eeb
File moved
test/golden.out
View file @
18890eeb
...
...
@@ -112,13 +112,6 @@ BUG: should compile
BUG: errchk: bugs/bug153.go:9: error message does not match 'nil'
bugs/bug153.go:9: fatal error: dowidth: unknown type: E-34
=========== bugs/bug154.go
r0 = 3.141592
r1 = 3.141592025756836
r0 and r1 should be the same
panic PC=xxx
BUG: should not panic
=========== fixedbugs/bug016.go
fixedbugs/bug016.go:7: constant -3 overflows uint
...
...
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