Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
68209ed5
Commit
68209ed5
authored
16 years ago
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix printing of -(1<<63)
R=r OCL=15441 CL=15445
parent
2902a82c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
30 deletions
+24
-30
src/runtime/print.c
src/runtime/print.c
+8
-4
test/golden.out
test/golden.out
+4
-26
test/printbig.go
test/printbig.go
+12
-0
No files found.
src/runtime/print.c
View file @
68209ed5
...
...
@@ -112,15 +112,16 @@ void
sys
·
printint
(
int64
v
)
{
byte
buf
[
100
];
int32
i
,
s
;
int32
i
,
s
,
big
;
big
=
0
;
s
=
0
;
if
(
v
<
0
)
{
v
=
-
v
;
s
=
1
;
if
(
v
<
0
)
{
sys
·
write
(
1
,
(
byte
*
)
"-oo"
,
3
)
;
return
;
big
=
1
;
v
--
;
}
}
...
...
@@ -130,10 +131,13 @@ sys·printint(int64 v)
break
;
v
=
v
/
10
;
}
if
(
s
)
{
if
(
s
){
i
--
;
buf
[
i
]
=
'-'
;
}
if
(
big
){
buf
[
nelem
(
buf
)
-
1
]
++
;
}
sys
·
write
(
1
,
buf
+
i
,
nelem
(
buf
)
-
i
);
}
...
...
This diff is collapsed.
Click to expand it.
test/golden.out
View file @
68209ed5
=========== ./bufiolib.go
throw: index out of range
SIGSEGV: segmentation violation
Faulting address: 0x0
pc: 0x11c43
0x11c43?zi
throw(98060, 0, 235528, ...)
throw(0x17f0c, 0x39808, 0x5e2e, ...)
0x11b97?zi
sys·throwindex(235528, 0, 0, ...)
sys·throwindex(0x39808, 0x0, 0x1, ...)
0x5e2e?zi
bufio·BufRead_ReadLineString(235312, 0, 65546, ...)
bufio·BufRead_ReadLineString(0x39730, 0x1000a, 0x39758, ...)
0x1cb8?zi
main·ReadLines(235312, 0, 235304, ...)
main·ReadLines(0x39730, 0x39728, 0x1, ...)
0x2bb5?zi
main·TestBufRead(85470, 0, 1, ...)
main·TestBufRead(0x14dde, 0x1, 0x7fff5fbff268, ...)
0x3830?zi
main·main(1, 0, 1606414952, ...)
main·main(0x1, 0x7fff5fbff268, 0x0, ...)
=========== ./func1.go
func1.go:12: var a redeclared in this block
previous declaration at func1.go:12
...
...
@@ -48,6 +22,10 @@ skipping increment test until bug060 is fixed
9! = 362880
10! = 3628800
=========== ./printbig.go
-9223372036854775808
9223372036854775807
=========== ./turing.go
Hello World!
...
...
This diff is collapsed.
Click to expand it.
test/printbig.go
0 → 100644
View file @
68209ed5
// $G $F.go && $L $F.$A && ./$A.out
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
main
func
main
()
{
print
(
-
(
1
<<
63
),
"
\n
"
);
print
((
1
<<
63
)
-
1
,
"
\n
"
)
}
This diff is collapsed.
Click to expand it.
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