From: Tobias Burnus Date: Mon, 23 Mar 2020 07:31:23 +0000 (+0100) Subject: Set proper DECL_ALIGN in offload_handle_link_vars (PR94233) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b809f0b6580969c4f047f4dae072c090718efd76;p=gcc.git Set proper DECL_ALIGN in offload_handle_link_vars (PR94233) gcc/lto/ PR middle-end/94233 * lto.c (offload_handle_link_vars): Cleanup; call build_decl to ensure alignment is set. --- diff --git a/gcc/lto/ChangeLog b/gcc/lto/ChangeLog index 1e5bab6594b..333f2a3d770 100644 --- a/gcc/lto/ChangeLog +++ b/gcc/lto/ChangeLog @@ -1,3 +1,9 @@ +2020-01-29 Tobias Burnus + + PR middle-end/94233 + * lto.c (offload_handle_link_vars): Cleanup; call + build_decl to ensure alignment is set. + 2020-02-05 Martin Liska PR lto/93489 diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 39bb5f45c95..467b922eedf 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -561,18 +561,14 @@ offload_handle_link_vars (void) DECL_ATTRIBUTES (var->decl))) { tree type = build_pointer_type (TREE_TYPE (var->decl)); - tree link_ptr_var = make_node (VAR_DECL); - TREE_TYPE (link_ptr_var) = type; - TREE_USED (link_ptr_var) = 1; - TREE_STATIC (link_ptr_var) = 1; - SET_DECL_MODE (link_ptr_var, TYPE_MODE (type)); - DECL_SIZE (link_ptr_var) = TYPE_SIZE (type); - DECL_SIZE_UNIT (link_ptr_var) = TYPE_SIZE_UNIT (type); - DECL_ARTIFICIAL (link_ptr_var) = 1; tree var_name = DECL_ASSEMBLER_NAME (var->decl); char *new_name = ACONCAT ((IDENTIFIER_POINTER (var_name), "_linkptr", NULL)); - DECL_NAME (link_ptr_var) = get_identifier (new_name); + tree link_ptr_var = build_decl (UNKNOWN_LOCATION, VAR_DECL, + get_identifier (new_name), type); + TREE_USED (link_ptr_var) = 1; + TREE_STATIC (link_ptr_var) = 1; + DECL_ARTIFICIAL (link_ptr_var) = 1; SET_DECL_ASSEMBLER_NAME (link_ptr_var, DECL_NAME (link_ptr_var)); SET_DECL_VALUE_EXPR (var->decl, build_simple_mem_ref (link_ptr_var)); DECL_HAS_VALUE_EXPR_P (var->decl) = 1;