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
5b0e99c9
Commit
5b0e99c9
authored
Dec 14, 2010
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't crash on erroneous receiver or parameters.
From-SVN: r167812
parent
cd96b4e2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
8 deletions
+26
-8
gcc/go/gofrontend/gogo-tree.cc
+26
-8
No files found.
gcc/go/gofrontend/gogo-tree.cc
View file @
5b0e99c9
...
...
@@ -1388,6 +1388,8 @@ Function_declaration::get_or_make_decl(Gogo* gogo, Named_object* no, tree id)
tree
Function
::
make_receiver_parm_decl
(
Gogo
*
gogo
,
Named_object
*
no
,
tree
var_decl
)
{
if
(
var_decl
==
error_mark_node
)
return
error_mark_node
;
// If the function takes the address of a receiver which is passed
// by value, then we will have an INDIRECT_REF here. We need to get
// the real variable.
...
...
@@ -1402,6 +1404,8 @@ Function::make_receiver_parm_decl(Gogo* gogo, Named_object* no, tree var_decl)
{
gcc_assert
(
is_in_heap
);
var_decl
=
TREE_OPERAND
(
var_decl
,
0
);
if
(
var_decl
==
error_mark_node
)
return
error_mark_node
;
gcc_assert
(
POINTER_TYPE_P
(
TREE_TYPE
(
var_decl
)));
val_type
=
TREE_TYPE
(
TREE_TYPE
(
var_decl
));
}
...
...
@@ -1460,9 +1464,14 @@ Function::make_receiver_parm_decl(Gogo* gogo, Named_object* no, tree var_decl)
tree
Function
::
copy_parm_to_heap
(
Gogo
*
gogo
,
Named_object
*
no
,
tree
ref
)
{
if
(
ref
==
error_mark_node
)
return
error_mark_node
;
gcc_assert
(
TREE_CODE
(
ref
)
==
INDIRECT_REF
);
tree
var_decl
=
TREE_OPERAND
(
ref
,
0
);
if
(
var_decl
==
error_mark_node
)
return
error_mark_node
;
gcc_assert
(
TREE_CODE
(
var_decl
)
==
VAR_DECL
);
source_location
loc
=
DECL_SOURCE_LOCATION
(
var_decl
);
...
...
@@ -1523,9 +1532,12 @@ Function::build_tree(Gogo* gogo, Named_object* named_function)
tree
var
=
*
pp
;
if
(
TREE_CODE
(
var
)
==
INDIRECT_REF
)
var
=
TREE_OPERAND
(
var
,
0
);
gcc_assert
(
TREE_CODE
(
var
)
==
VAR_DECL
);
DECL_CHAIN
(
var
)
=
declare_vars
;
declare_vars
=
var
;
if
(
var
!=
error_mark_node
)
{
gcc_assert
(
TREE_CODE
(
var
)
==
VAR_DECL
);
DECL_CHAIN
(
var
)
=
declare_vars
;
declare_vars
=
var
;
}
*
pp
=
parm_decl
;
}
else
if
((
*
p
)
->
var_value
()
->
is_in_heap
())
...
...
@@ -1533,11 +1545,17 @@ Function::build_tree(Gogo* gogo, Named_object* named_function)
// If we take the address of a parameter, then we need
// to copy it into the heap.
tree
parm_decl
=
this
->
copy_parm_to_heap
(
gogo
,
*
p
,
*
pp
);
gcc_assert
(
TREE_CODE
(
*
pp
)
==
INDIRECT_REF
);
tree
var_decl
=
TREE_OPERAND
(
*
pp
,
0
);
gcc_assert
(
TREE_CODE
(
var_decl
)
==
VAR_DECL
);
DECL_CHAIN
(
var_decl
)
=
declare_vars
;
declare_vars
=
var_decl
;
if
(
*
pp
!=
error_mark_node
)
{
gcc_assert
(
TREE_CODE
(
*
pp
)
==
INDIRECT_REF
);
tree
var_decl
=
TREE_OPERAND
(
*
pp
,
0
);
if
(
var_decl
!=
error_mark_node
)
{
gcc_assert
(
TREE_CODE
(
var_decl
)
==
VAR_DECL
);
DECL_CHAIN
(
var_decl
)
=
declare_vars
;
declare_vars
=
var_decl
;
}
}
*
pp
=
parm_decl
;
}
...
...
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