diff options
Diffstat (limited to 'gcc/go/go-gcc.cc')
-rw-r--r-- | gcc/go/go-gcc.cc | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/gcc/go/go-gcc.cc b/gcc/go/go-gcc.cc index 5b95e5d..df4b670 100644 --- a/gcc/go/go-gcc.cc +++ b/gcc/go/go-gcc.cc @@ -389,7 +389,8 @@ class Gcc_backend : public Backend Location, Bstatement**); Bvariable* - implicit_variable(const std::string&, Btype*, Bexpression*, bool); + implicit_variable(const std::string&, Btype*, Bexpression*, bool, bool, + size_t); Bvariable* immutable_struct(const std::string&, bool, bool, Btype*, Location); @@ -2497,10 +2498,15 @@ Gcc_backend::temporary_variable(Bfunction* function, Bblock* bblock, Bvariable* Gcc_backend::implicit_variable(const std::string& name, Btype* type, - Bexpression* init, bool is_constant) + Bexpression* init, bool is_constant, + bool is_common, size_t alignment) { tree type_tree = type->get_tree(); - tree init_tree = init->get_tree(); + tree init_tree; + if (init == NULL) + init_tree = NULL_TREE; + else + init_tree = init->get_tree(); if (type_tree == error_mark_node || init_tree == error_mark_node) return this->error_variable(); @@ -2510,12 +2516,25 @@ Gcc_backend::implicit_variable(const std::string& name, Btype* type, TREE_PUBLIC(decl) = 0; TREE_STATIC(decl) = 1; DECL_ARTIFICIAL(decl) = 1; - if (is_constant) + if (is_common) + { + DECL_COMMON(decl) = 1; + TREE_PUBLIC(decl) = 1; + gcc_assert(init_tree == NULL_TREE); + } + else if (is_constant) { TREE_READONLY(decl) = 1; TREE_CONSTANT(decl) = 1; } DECL_INITIAL(decl) = init_tree; + + if (alignment != 0) + { + DECL_ALIGN(decl) = alignment * BITS_PER_UNIT; + DECL_USER_ALIGN(decl) = 1; + } + rest_of_decl_compilation(decl, 1, 0); return new Bvariable(decl); |