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
7e813472
Commit
7e813472
authored
Oct 18, 2014
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compiler: Don't allow tuple assignments to contain duplicate symbols.
Fixes issue 8436. From-SVN: r216420
parent
10e77e32
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
gcc/go/gofrontend/parse.cc
+12
-0
No files found.
gcc/go/gofrontend/parse.cc
View file @
7e813472
...
@@ -2088,6 +2088,9 @@ Parse::simple_var_decl_or_assignment(const std::string& name,
...
@@ -2088,6 +2088,9 @@ Parse::simple_var_decl_or_assignment(const std::string& name,
Typed_identifier_list
til
;
Typed_identifier_list
til
;
til
.
push_back
(
Typed_identifier
(
name
,
NULL
,
location
));
til
.
push_back
(
Typed_identifier
(
name
,
NULL
,
location
));
std
::
set
<
std
::
string
>
uniq_idents
;
uniq_idents
.
insert
(
name
);
// We've seen one identifier. If we see a comma now, this could be
// We've seen one identifier. If we see a comma now, this could be
// "a, *p = 1, 2".
// "a, *p = 1, 2".
if
(
this
->
peek_token
()
->
is_op
(
OPERATOR_COMMA
))
if
(
this
->
peek_token
()
->
is_op
(
OPERATOR_COMMA
))
...
@@ -2102,6 +2105,7 @@ Parse::simple_var_decl_or_assignment(const std::string& name,
...
@@ -2102,6 +2105,7 @@ Parse::simple_var_decl_or_assignment(const std::string& name,
std
::
string
id
=
token
->
identifier
();
std
::
string
id
=
token
->
identifier
();
bool
is_id_exported
=
token
->
is_identifier_exported
();
bool
is_id_exported
=
token
->
is_identifier_exported
();
Location
id_location
=
token
->
location
();
Location
id_location
=
token
->
location
();
std
::
pair
<
std
::
set
<
std
::
string
>::
iterator
,
bool
>
ins
;
token
=
this
->
advance_token
();
token
=
this
->
advance_token
();
if
(
!
token
->
is_op
(
OPERATOR_COMMA
))
if
(
!
token
->
is_op
(
OPERATOR_COMMA
))
...
@@ -2109,6 +2113,10 @@ Parse::simple_var_decl_or_assignment(const std::string& name,
...
@@ -2109,6 +2113,10 @@ Parse::simple_var_decl_or_assignment(const std::string& name,
if
(
token
->
is_op
(
OPERATOR_COLONEQ
))
if
(
token
->
is_op
(
OPERATOR_COLONEQ
))
{
{
id
=
this
->
gogo_
->
pack_hidden_name
(
id
,
is_id_exported
);
id
=
this
->
gogo_
->
pack_hidden_name
(
id
,
is_id_exported
);
ins
=
uniq_idents
.
insert
(
id
);
if
(
!
ins
.
second
&&
!
Gogo
::
is_sink_name
(
id
))
error_at
(
id_location
,
"multiple assignments to %s"
,
Gogo
::
message_name
(
id
).
c_str
());
til
.
push_back
(
Typed_identifier
(
id
,
NULL
,
location
));
til
.
push_back
(
Typed_identifier
(
id
,
NULL
,
location
));
}
}
else
else
...
@@ -2119,6 +2127,10 @@ Parse::simple_var_decl_or_assignment(const std::string& name,
...
@@ -2119,6 +2127,10 @@ Parse::simple_var_decl_or_assignment(const std::string& name,
}
}
id
=
this
->
gogo_
->
pack_hidden_name
(
id
,
is_id_exported
);
id
=
this
->
gogo_
->
pack_hidden_name
(
id
,
is_id_exported
);
ins
=
uniq_idents
.
insert
(
id
);
if
(
!
ins
.
second
&&
!
Gogo
::
is_sink_name
(
id
))
error_at
(
id_location
,
"multiple assignments to %s"
,
Gogo
::
message_name
(
id
).
c_str
());
til
.
push_back
(
Typed_identifier
(
id
,
NULL
,
location
));
til
.
push_back
(
Typed_identifier
(
id
,
NULL
,
location
));
}
}
...
...
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