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
5ada0122
Commit
5ada0122
authored
Apr 24, 2012
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compiler: Fix order of evalation for m[0] = len(m) when m is a map.
From-SVN: r186772
parent
24d5b351
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
gcc/go/gofrontend/gogo.cc
+12
-6
No files found.
gcc/go/gofrontend/gogo.cc
View file @
5ada0122
...
...
@@ -2216,12 +2216,18 @@ Order_eval::statement(Block* block, size_t* pindex, Statement* s)
Expression
::
traverse
(
&
init
,
&
find_eval_ordering
);
}
if
(
find_eval_ordering
.
size
()
<=
1
)
{
// If there is only one expression with a side-effect, we can
// leave it in place.
return
TRAVERSE_CONTINUE
;
}
size_t
c
=
find_eval_ordering
.
size
();
if
(
c
==
0
)
return
TRAVERSE_CONTINUE
;
// If there is only one expression with a side-effect, we can
// usually leave it in place. However, for an assignment statement,
// we need to evaluate an expression on the right hand side before
// we evaluate any index expression on the left hand side, so for
// that case we always move the expression. Otherwise we mishandle
// m[0] = len(m) where m is a map.
if
(
c
==
1
&&
s
->
classification
()
!=
Statement
::
STATEMENT_ASSIGNMENT
)
return
TRAVERSE_CONTINUE
;
bool
is_thunk
=
s
->
thunk_statement
()
!=
NULL
;
for
(
Find_eval_ordering
::
const_iterator
p
=
find_eval_ordering
.
begin
();
...
...
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