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
80678229
Commit
80678229
authored
Feb 01, 2012
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compiler: Fix type checking for append.
From-SVN: r183816
parent
7c275c43
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
gcc/go/gofrontend/expressions.cc
+13
-6
No files found.
gcc/go/gofrontend/expressions.cc
View file @
80678229
...
@@ -7657,7 +7657,10 @@ Builtin_call_expression::do_lower(Gogo* gogo, Named_object* function,
...
@@ -7657,7 +7657,10 @@ Builtin_call_expression::do_lower(Gogo* gogo, Named_object* function,
this
->
set_is_error
();
this
->
set_is_error
();
return
this
;
return
this
;
}
}
this
->
lower_varargs
(
gogo
,
function
,
inserter
,
slice_type
,
2
);
Type
*
element_type
=
slice_type
->
array_type
()
->
element_type
();
this
->
lower_varargs
(
gogo
,
function
,
inserter
,
Type
::
make_array_type
(
element_type
,
NULL
),
2
);
}
}
break
;
break
;
...
@@ -8624,16 +8627,20 @@ Builtin_call_expression::do_check_types(Gogo*)
...
@@ -8624,16 +8627,20 @@ Builtin_call_expression::do_check_types(Gogo*)
break
;
break
;
}
}
// The language says that the second argument must be
// assignable to a slice of the element type of the first
// argument. We already know the first argument is a slice
// type.
Array_type
*
at
=
args
->
front
()
->
type
()
->
array_type
();
Type
*
arg2_type
=
Type
::
make_array_type
(
at
->
element_type
(),
NULL
);
std
::
string
reason
;
std
::
string
reason
;
if
(
!
Type
::
are_assignable
(
args
->
front
()
->
type
(),
args
->
back
()
->
type
(),
if
(
!
Type
::
are_assignable
(
arg2_type
,
args
->
back
()
->
type
(),
&
reason
))
&
reason
))
{
{
if
(
reason
.
empty
())
if
(
reason
.
empty
())
this
->
report_error
(
_
(
"argument
s 1 and 2 have different types
"
));
this
->
report_error
(
_
(
"argument
2 has invalid type
"
));
else
else
{
{
error_at
(
this
->
location
(),
error_at
(
this
->
location
(),
"argument 2 has invalid type (%s)"
,
"arguments 1 and 2 have different types (%s)"
,
reason
.
c_str
());
reason
.
c_str
());
this
->
set_is_error
();
this
->
set_is_error
();
}
}
...
...
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