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
df4ddb11
Commit
df4ddb11
authored
May 15, 2012
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compiler: Fix taking address of constant outside of function.
From-SVN: r187565
parent
8345ae93
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
9 deletions
+40
-9
gcc/go/gofrontend/expressions.cc
+40
-9
No files found.
gcc/go/gofrontend/expressions.cc
View file @
df4ddb11
...
@@ -4048,15 +4048,46 @@ Unary_expression::do_get_tree(Translate_context* context)
...
@@ -4048,15 +4048,46 @@ Unary_expression::do_get_tree(Translate_context* context)
&&
TREE_CODE
(
expr
)
!=
INDIRECT_REF
&&
TREE_CODE
(
expr
)
!=
INDIRECT_REF
&&
TREE_CODE
(
expr
)
!=
COMPONENT_REF
)
&&
TREE_CODE
(
expr
)
!=
COMPONENT_REF
)
{
{
tree
tmp
=
create_tmp_var
(
TREE_TYPE
(
expr
),
get_name
(
expr
));
if
(
current_function_decl
!=
NULL
)
DECL_IGNORED_P
(
tmp
)
=
1
;
{
DECL_INITIAL
(
tmp
)
=
expr
;
tree
tmp
=
create_tmp_var
(
TREE_TYPE
(
expr
),
get_name
(
expr
));
TREE_ADDRESSABLE
(
tmp
)
=
1
;
DECL_IGNORED_P
(
tmp
)
=
1
;
return
build2_loc
(
loc
.
gcc_location
(),
COMPOUND_EXPR
,
DECL_INITIAL
(
tmp
)
=
expr
;
build_pointer_type
(
TREE_TYPE
(
expr
)),
TREE_ADDRESSABLE
(
tmp
)
=
1
;
build1_loc
(
loc
.
gcc_location
(),
DECL_EXPR
,
return
build2_loc
(
loc
.
gcc_location
(),
COMPOUND_EXPR
,
void_type_node
,
tmp
),
build_pointer_type
(
TREE_TYPE
(
expr
)),
build_fold_addr_expr_loc
(
loc
.
gcc_location
(),
tmp
));
build1_loc
(
loc
.
gcc_location
(),
DECL_EXPR
,
void_type_node
,
tmp
),
build_fold_addr_expr_loc
(
loc
.
gcc_location
(),
tmp
));
}
else
{
tree
tmp
=
build_decl
(
loc
.
gcc_location
(),
VAR_DECL
,
create_tmp_var_name
(
"A"
),
TREE_TYPE
(
expr
));
DECL_EXTERNAL
(
tmp
)
=
0
;
TREE_PUBLIC
(
tmp
)
=
0
;
TREE_STATIC
(
tmp
)
=
1
;
DECL_ARTIFICIAL
(
tmp
)
=
1
;
TREE_ADDRESSABLE
(
tmp
)
=
1
;
tree
make_tmp
;
if
(
!
TREE_CONSTANT
(
expr
))
make_tmp
=
fold_build2_loc
(
loc
.
gcc_location
(),
INIT_EXPR
,
void_type_node
,
tmp
,
expr
);
else
{
TREE_READONLY
(
tmp
)
=
1
;
TREE_CONSTANT
(
tmp
)
=
1
;
DECL_INITIAL
(
tmp
)
=
expr
;
make_tmp
=
NULL_TREE
;
}
rest_of_decl_compilation
(
tmp
,
1
,
0
);
tree
addr
=
build_fold_addr_expr_loc
(
loc
.
gcc_location
(),
tmp
);
if
(
make_tmp
==
NULL_TREE
)
return
addr
;
return
build2_loc
(
loc
.
gcc_location
(),
COMPOUND_EXPR
,
TREE_TYPE
(
addr
),
make_tmp
,
addr
);
}
}
}
return
build_fold_addr_expr_loc
(
loc
.
gcc_location
(),
expr
);
return
build_fold_addr_expr_loc
(
loc
.
gcc_location
(),
expr
);
...
...
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