From d905e48d6af0445c7941cd2e638461db2f4d9ee8 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Mon, 31 Aug 2026 00:49:46 +0200 Subject: Type check for value addressability --- gcc/gcc/elna-builtins.cc | 2 -- gcc/gcc/elna-generic.cc | 5 ++++- gcc/gcc/elna-tree.cc | 1 - 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc') diff --git a/gcc/gcc/elna-builtins.cc b/gcc/gcc/elna-builtins.cc index 3d10c44..18dcc52 100644 --- a/gcc/gcc/elna-builtins.cc +++ b/gcc/gcc/elna-builtins.cc @@ -330,7 +330,6 @@ namespace elna::gcc function_args_iter_next(¶meter_type); } DECL_ARGUMENTS(fndecl) = argument_chain; - TREE_ADDRESSABLE(fndecl) = 1; DECL_EXTERNAL(fndecl) = static_cast(info.is_extern()); TREE_PUBLIC(fndecl) = static_cast(info.exported); } @@ -341,7 +340,6 @@ namespace elna::gcc tree variable_type = get_inner_alias(info.symbol, symbols); tree declaration_tree = build_decl(UNKNOWN_LOCATION, VAR_DECL, get_identifier(name.c_str()), variable_type); - TREE_ADDRESSABLE(declaration_tree) = 1; DECL_EXTERNAL(declaration_tree) = static_cast(info.is_extern); TREE_PUBLIC(declaration_tree) = static_cast(info.exported); diff --git a/gcc/gcc/elna-generic.cc b/gcc/gcc/elna-generic.cc index 659a8c1..e2d50b4 100644 --- a/gcc/gcc/elna-generic.cc +++ b/gcc/gcc/elna-generic.cc @@ -650,8 +650,11 @@ namespace elna::gcc { using enum boot::unary_operator; case reference: + if (DECL_P(this->current_expression)) + { + TREE_ADDRESSABLE(this->current_expression) = 1; + } this->current_expression = prepare_rvalue(this->current_expression); - TREE_ADDRESSABLE(this->current_expression) = 1; this->current_expression = build_fold_addr_expr_with_type_loc(location, this->current_expression, build_pointer_type(TREE_TYPE(this->current_expression))); diff --git a/gcc/gcc/elna-tree.cc b/gcc/gcc/elna-tree.cc index e4c8a20..cddb407 100644 --- a/gcc/gcc/elna-tree.cc +++ b/gcc/gcc/elna-tree.cc @@ -92,7 +92,6 @@ namespace elna::gcc { tree field_declaration = build_decl(location, FIELD_DECL, get_identifier(name.c_str()), type); - TREE_ADDRESSABLE(field_declaration) = 1; DECL_CONTEXT(field_declaration) = record_type; return field_declaration; -- cgit v1.2.3