Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
10d91e57
Commit
10d91e57
authored
Dec 12, 2013
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compiler: Don't compare structs with blank non-comparable fields.
From-SVN: r205937
parent
f7685b66
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
7 deletions
+4
-7
gcc/go/gofrontend/types.cc
+0
-3
gcc/testsuite/go.test/test/cmp.go
+3
-3
gcc/testsuite/go.test/test/cmp6.go
+1
-1
No files found.
gcc/go/gofrontend/types.cc
View file @
10d91e57
...
@@ -575,9 +575,6 @@ Type::are_compatible_for_comparison(bool is_equality_op, const Type *t1,
...
@@ -575,9 +575,6 @@ Type::are_compatible_for_comparison(bool is_equality_op, const Type *t1,
p
!=
fields
->
end
();
p
!=
fields
->
end
();
++
p
)
++
p
)
{
{
if
(
Gogo
::
is_sink_name
(
p
->
field_name
()))
continue
;
if
(
!
p
->
type
()
->
is_comparable
())
if
(
!
p
->
type
()
->
is_comparable
())
{
{
if
(
reason
!=
NULL
)
if
(
reason
!=
NULL
)
...
...
gcc/testsuite/go.test/test/cmp.go
View file @
10d91e57
...
@@ -43,8 +43,8 @@ func main() {
...
@@ -43,8 +43,8 @@ func main() {
var
d
string
=
"hel"
// try to get different pointer
var
d
string
=
"hel"
// try to get different pointer
d
=
d
+
"lo"
d
=
d
+
"lo"
//
exp
/ssa/interp can't handle unsafe.Pointer.
//
go.tools
/ssa/interp can't handle unsafe.Pointer.
if
os
.
Getenv
(
"GOSSAINTERP"
)
!
=
""
{
if
os
.
Getenv
(
"GOSSAINTERP"
)
=
=
""
{
if
stringptr
(
c
)
==
stringptr
(
d
)
{
if
stringptr
(
c
)
==
stringptr
(
d
)
{
panic
(
"compiler too smart -- got same string"
)
panic
(
"compiler too smart -- got same string"
)
}
}
...
@@ -296,7 +296,7 @@ func main() {
...
@@ -296,7 +296,7 @@ func main() {
{
{
var
x
=
struct
{
var
x
=
struct
{
x
int
x
int
_
[]
int
_
string
y
float64
y
float64
_
float64
_
float64
z
int
z
int
...
...
gcc/testsuite/go.test/test/cmp6.go
View file @
10d91e57
...
@@ -53,7 +53,7 @@ func main() {
...
@@ -53,7 +53,7 @@ func main() {
// Comparison of structs should have a good message
// Comparison of structs should have a good message
use
(
t3
==
t3
)
// ERROR "struct|expected"
use
(
t3
==
t3
)
// ERROR "struct|expected"
use
(
t4
==
t4
)
//
ok; the []int is a blank field
use
(
t4
==
t4
)
//
ERROR "cannot be compared|non-comparable"
// Slices, functions, and maps too.
// Slices, functions, and maps too.
var
x
[]
int
var
x
[]
int
...
...
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