aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2010-01-18 16:42:05 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2010-01-18 15:42:05 +0000
commit8b7b0c36aa8546ae6893a01a53995baf680c2388 (patch)
treeb651b6fca641f62fb15a629675a5e9a97f9ad4a0 /gcc/ada/gcc-interface/utils.c
parent413ebfc3359f5c8dfe11cea333b04a65134c0edc (diff)
downloadgcc-8b7b0c36aa8546ae6893a01a53995baf680c2388.zip
gcc-8b7b0c36aa8546ae6893a01a53995baf680c2388.tar.gz
gcc-8b7b0c36aa8546ae6893a01a53995baf680c2388.tar.bz2
re PR ada/42068 (ICE in function_and_variable_visibility)
PR middle-end/42068 (create_var_decl_1): Do not set COMMON flag for unit local variables. From-SVN: r156010
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r--gcc/ada/gcc-interface/utils.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 38795a0..5175654 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -1387,6 +1387,13 @@ create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init,
that is, not violating a No_Elaboration_Code restriction. */
if (global_bindings_p () && var_init != 0 && ! init_const)
Check_Elaboration_Code_Allowed (gnat_node);
+ DECL_INITIAL (var_decl) = var_init;
+ TREE_READONLY (var_decl) = const_flag;
+ DECL_EXTERNAL (var_decl) = extern_flag;
+ TREE_PUBLIC (var_decl) = public_flag || extern_flag;
+ TREE_CONSTANT (var_decl) = constant_p;
+ TREE_THIS_VOLATILE (var_decl) = TREE_SIDE_EFFECTS (var_decl)
+ = TYPE_VOLATILE (type);
/* Ada doesn't feature Fortran-like COMMON variables so we shouldn't
try to fiddle with DECL_COMMON. However, on platforms that don't
@@ -1394,15 +1401,9 @@ create_var_decl_1 (tree var_name, tree asm_name, tree type, tree var_init,
go in DATA instead, thus increasing the size of the executable. */
if (!flag_no_common
&& TREE_CODE (var_decl) == VAR_DECL
+ && TREE_PUBLIC (var_decl)
&& !have_global_bss_p ())
DECL_COMMON (var_decl) = 1;
- DECL_INITIAL (var_decl) = var_init;
- TREE_READONLY (var_decl) = const_flag;
- DECL_EXTERNAL (var_decl) = extern_flag;
- TREE_PUBLIC (var_decl) = public_flag || extern_flag;
- TREE_CONSTANT (var_decl) = constant_p;
- TREE_THIS_VOLATILE (var_decl) = TREE_SIDE_EFFECTS (var_decl)
- = TYPE_VOLATILE (type);
/* If it's public and not external, always allocate storage for it.
At the global binding level we need to allocate static storage for the