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
a39fd33d
Commit
a39fd33d
authored
Sep 13, 2011
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Always dereference nil receiver passed to value method.
From-SVN: r178835
parent
43052d45
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
21 deletions
+3
-21
gcc/go/gofrontend/gogo-tree.cc
+3
-21
No files found.
gcc/go/gofrontend/gogo-tree.cc
View file @
a39fd33d
...
@@ -1281,16 +1281,7 @@ Function::make_receiver_parm_decl(Gogo* gogo, Named_object* no, tree var_decl)
...
@@ -1281,16 +1281,7 @@ Function::make_receiver_parm_decl(Gogo* gogo, Named_object* no, tree var_decl)
DECL_ARG_TYPE
(
parm_decl
)
=
TREE_TYPE
(
parm_decl
);
DECL_ARG_TYPE
(
parm_decl
)
=
TREE_TYPE
(
parm_decl
);
go_assert
(
DECL_INITIAL
(
var_decl
)
==
NULL_TREE
);
go_assert
(
DECL_INITIAL
(
var_decl
)
==
NULL_TREE
);
// The receiver might be passed as a null pointer.
tree
init
=
build_fold_indirect_ref_loc
(
loc
,
parm_decl
);
tree
check
=
fold_build2_loc
(
loc
,
NE_EXPR
,
boolean_type_node
,
parm_decl
,
fold_convert_loc
(
loc
,
TREE_TYPE
(
parm_decl
),
null_pointer_node
));
tree
ind
=
build_fold_indirect_ref_loc
(
loc
,
parm_decl
);
TREE_THIS_NOTRAP
(
ind
)
=
1
;
Btype
*
btype
=
no
->
var_value
()
->
type
()
->
get_backend
(
gogo
);
tree
zero_init
=
expr_to_tree
(
gogo
->
backend
()
->
zero_expression
(
btype
));
tree
init
=
fold_build3_loc
(
loc
,
COND_EXPR
,
TREE_TYPE
(
ind
),
check
,
ind
,
zero_init
);
if
(
is_in_heap
)
if
(
is_in_heap
)
{
{
...
@@ -1301,18 +1292,9 @@ Function::make_receiver_parm_decl(Gogo* gogo, Named_object* no, tree var_decl)
...
@@ -1301,18 +1292,9 @@ Function::make_receiver_parm_decl(Gogo* gogo, Named_object* no, tree var_decl)
space
=
fold_convert
(
build_pointer_type
(
val_type
),
space
);
space
=
fold_convert
(
build_pointer_type
(
val_type
),
space
);
tree
spaceref
=
build_fold_indirect_ref_loc
(
no
->
location
(),
space
);
tree
spaceref
=
build_fold_indirect_ref_loc
(
no
->
location
(),
space
);
TREE_THIS_NOTRAP
(
spaceref
)
=
1
;
TREE_THIS_NOTRAP
(
spaceref
)
=
1
;
tree
check
=
fold_build2_loc
(
loc
,
NE_EXPR
,
boolean_type_node
,
parm_decl
,
fold_convert_loc
(
loc
,
TREE_TYPE
(
parm_decl
),
null_pointer_node
));
tree
parmref
=
build_fold_indirect_ref_loc
(
no
->
location
(),
parm_decl
);
TREE_THIS_NOTRAP
(
parmref
)
=
1
;
tree
set
=
fold_build2_loc
(
loc
,
MODIFY_EXPR
,
void_type_node
,
tree
set
=
fold_build2_loc
(
loc
,
MODIFY_EXPR
,
void_type_node
,
spaceref
,
parmref
);
spaceref
,
init
);
init
=
fold_build2_loc
(
loc
,
COMPOUND_EXPR
,
TREE_TYPE
(
space
),
init
=
fold_build2_loc
(
loc
,
COMPOUND_EXPR
,
TREE_TYPE
(
space
),
set
,
space
);
build3
(
COND_EXPR
,
void_type_node
,
check
,
set
,
NULL_TREE
),
space
);
}
}
DECL_INITIAL
(
var_decl
)
=
init
;
DECL_INITIAL
(
var_decl
)
=
init
;
...
...
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