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
5ae2ca96
Commit
5ae2ca96
authored
Dec 21, 2010
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't crash on invalid return statement.
From-SVN: r168102
parent
bc77e3e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
gcc/go/gofrontend/statements.cc
+8
-4
No files found.
gcc/go/gofrontend/statements.cc
View file @
5ae2ca96
...
@@ -2567,6 +2567,8 @@ Return_statement::do_get_tree(Translate_context* context)
...
@@ -2567,6 +2567,8 @@ Return_statement::do_get_tree(Translate_context* context)
{
{
Function
*
function
=
context
->
function
()
->
func_value
();
Function
*
function
=
context
->
function
()
->
func_value
();
tree
fndecl
=
function
->
get_decl
();
tree
fndecl
=
function
->
get_decl
();
if
(
fndecl
==
error_mark_node
||
DECL_RESULT
(
fndecl
)
==
error_mark_node
)
return
error_mark_node
;
const
Typed_identifier_list
*
results
=
this
->
results_
;
const
Typed_identifier_list
*
results
=
this
->
results_
;
...
@@ -2580,6 +2582,8 @@ Return_statement::do_get_tree(Translate_context* context)
...
@@ -2580,6 +2582,8 @@ Return_statement::do_get_tree(Translate_context* context)
tree
set
;
tree
set
;
if
(
retval
==
NULL_TREE
)
if
(
retval
==
NULL_TREE
)
set
=
NULL_TREE
;
set
=
NULL_TREE
;
else
if
(
retval
==
error_mark_node
)
return
error_mark_node
;
else
else
set
=
fold_build2_loc
(
this
->
location
(),
MODIFY_EXPR
,
void_type_node
,
set
=
fold_build2_loc
(
this
->
location
(),
MODIFY_EXPR
,
void_type_node
,
DECL_RESULT
(
fndecl
),
retval
);
DECL_RESULT
(
fndecl
),
retval
);
...
@@ -2591,13 +2595,13 @@ Return_statement::do_get_tree(Translate_context* context)
...
@@ -2591,13 +2595,13 @@ Return_statement::do_get_tree(Translate_context* context)
{
{
gcc_assert
(
!
VOID_TYPE_P
(
TREE_TYPE
(
TREE_TYPE
(
fndecl
))));
gcc_assert
(
!
VOID_TYPE_P
(
TREE_TYPE
(
TREE_TYPE
(
fndecl
))));
tree
val
=
(
*
this
->
vals_
->
begin
())
->
get_tree
(
context
);
tree
val
=
(
*
this
->
vals_
->
begin
())
->
get_tree
(
context
);
if
(
val
==
error_mark_node
)
return
error_mark_node
;
gcc_assert
(
results
!=
NULL
&&
results
->
size
()
==
1
);
gcc_assert
(
results
!=
NULL
&&
results
->
size
()
==
1
);
val
=
Expression
::
convert_for_assignment
(
context
,
val
=
Expression
::
convert_for_assignment
(
context
,
results
->
begin
()
->
type
(),
results
->
begin
()
->
type
(),
(
*
this
->
vals_
->
begin
())
->
type
(),
(
*
this
->
vals_
->
begin
())
->
type
(),
val
,
this
->
location
());
val
,
this
->
location
());
if
(
val
==
error_mark_node
)
return
error_mark_node
;
tree
set
=
build2
(
MODIFY_EXPR
,
void_type_node
,
tree
set
=
build2
(
MODIFY_EXPR
,
void_type_node
,
DECL_RESULT
(
fndecl
),
val
);
DECL_RESULT
(
fndecl
),
val
);
SET_EXPR_LOCATION
(
set
,
this
->
location
());
SET_EXPR_LOCATION
(
set
,
this
->
location
());
...
@@ -2618,11 +2622,11 @@ Return_statement::do_get_tree(Translate_context* context)
...
@@ -2618,11 +2622,11 @@ Return_statement::do_get_tree(Translate_context* context)
{
{
gcc_assert
(
pv
!=
this
->
vals_
->
end
());
gcc_assert
(
pv
!=
this
->
vals_
->
end
());
tree
val
=
(
*
pv
)
->
get_tree
(
context
);
tree
val
=
(
*
pv
)
->
get_tree
(
context
);
if
(
val
==
error_mark_node
)
return
error_mark_node
;
val
=
Expression
::
convert_for_assignment
(
context
,
pr
->
type
(),
val
=
Expression
::
convert_for_assignment
(
context
,
pr
->
type
(),
(
*
pv
)
->
type
(),
val
,
(
*
pv
)
->
type
(),
val
,
this
->
location
());
this
->
location
());
if
(
val
==
error_mark_node
)
return
error_mark_node
;
tree
set
=
build2
(
MODIFY_EXPR
,
void_type_node
,
tree
set
=
build2
(
MODIFY_EXPR
,
void_type_node
,
build3
(
COMPONENT_REF
,
TREE_TYPE
(
field
),
build3
(
COMPONENT_REF
,
TREE_TYPE
(
field
),
retvar
,
field
,
NULL_TREE
),
retvar
,
field
,
NULL_TREE
),
...
...
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