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
24b3995c
Commit
24b3995c
authored
Sep 11, 2008
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- 2 bugs with composite literals
R=r OCL=15179 CL=15179
parent
94979c31
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
0 deletions
+81
-0
test/bugs/bug096.go
test/bugs/bug096.go
+25
-0
test/bugs/bug097.go
test/bugs/bug097.go
+47
-0
test/golden.out
test/golden.out
+9
-0
No files found.
test/bugs/bug096.go
0 → 100644
View file @
24b3995c
// $G $D/$F.go || echo BUG should compile
// 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
type
A
[]
int
;
func
main
()
{
a
:=
&
A
{
0
};
b
:=
&
A
{
0
,
1
};
}
/*
uetli:~/Source/go1/test/bugs gri$ 6g bug096.go && 6l bug096.6 && 6.out
Trace/BPT trap
uetli:~/Source/go1/test/bugs gri$
*/
/*
It appears that the first assignment changes the size of A from open
into a fixed array.
*/
test/bugs/bug097.go
0 → 100644
View file @
24b3995c
// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG wrong result
// 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
type
A
[]
int
;
func
main
()
{
var
a
[
3
]
*
A
;
for
i
:=
0
;
i
<
3
;
i
++
{
a
[
i
]
=
&
A
{
i
};
}
if
a
[
0
][
0
]
!=
0
{
panic
();
}
if
a
[
1
][
0
]
!=
1
{
panic
();
}
if
a
[
2
][
0
]
!=
2
{
panic
();
}
}
/*
uetli:~/Source/go1/test/bugs gri$ 6g bug097.go && 6l bug097.6 && 6.out
panic on line 342 PC=0x13c2
0x13c2?zi
main·main(1, 0, 1606416416, ...)
main·main(0x1, 0x7fff5fbff820, 0x0, ...)
SIGTRAP: trace trap
Faulting address: 0x4558
pc: 0x4558
0x4558?zi
sys·breakpoint(40960, 0, 45128, ...)
sys·breakpoint(0xa000, 0xb048, 0xa000, ...)
0x156a?zi
sys·panicl(342, 0, 0, ...)
sys·panicl(0x156, 0x300000000, 0xb024, ...)
0x13c2?zi
main·main(1, 0, 1606416416, ...)
main·main(0x1, 0x7fff5fbff820, 0x0, ...)
*/
/* An array composite literal needs to be created freshly every time.
It is a "construction" of an array after all. If I pass the address
of the array to some function, it may store it globally. Same applies
to struct literals.
*/
test/golden.out
View file @
24b3995c
...
...
@@ -156,6 +156,15 @@ panic on line 342 PC=0x139e
BUG wrong result
Trace/BPT trap ./$A.out
=========== bugs/bug097.go
panic on line 344 PC=0x13c2
0x13c2?zi
main·main(1, 0, 1606416392, ...)
main·main(0x1, 0x7fff5fbff808, 0x0, ...)
BUG wrong result
Trace/BPT trap ./$A.out
=========== fixedbugs/bug015.go
fixedbugs/bug015.go:7: overflow converting constant to <int64>INT64
...
...
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