From 8c1b16bcbc337f5207771e6304632e7454658788 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 29 Aug 2005 17:41:45 +0200 Subject: re PR ada/21053 (Warnings from init.c) 2005-08-29 Arnaud Charlet Doug Rupp * s-stalib.adb: Add missing pragma Warnings (On) to reenable Warnings when needed. (Inside_Elab_Final_Code): Moved to init.c to avoid having to keep this code in the GNAT run-time. * decl.c, fe.h: Replace GCC_ZCX by Back_End_Exceptions. PR ada/21053 * init.c (__gnat_error_handler [many]): Mark "msg" as const (__gnat_error_handler [HPUX]): Mark siginfo parameter as unused (__gnat_inside_elab_final_code): Moved here from Standard_Library and only defined for the compiler. __gnat_error_handler [VMS]: Adjust sigargs to account for PC & PSL. (__gnat_inum_to_ivec): Do not define this function on VxWorks when using RTPs because directly vectored Interrupt routines are not supported on this configuration. (getpid): Do not redefine this function on VxWorks when using RTPs because this primitive is well supported by the RTP libraries. (copy_msg): Correct the code that checks for buffer overflow. Discovered during code reading. From-SVN: r103606 --- gcc/ada/decl.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'gcc/ada/decl.c') diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c index 65fa60f..701501e8 100644 --- a/gcc/ada/decl.c +++ b/gcc/ada/decl.c @@ -497,6 +497,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) || Present (Renamed_Object (gnat_entity)))); bool inner_const_flag = const_flag; bool static_p = Is_Statically_Allocated (gnat_entity); + bool mutable_p = false; tree gnu_ext_name = NULL_TREE; tree renamed_obj = NULL_TREE; @@ -594,7 +595,10 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) (Etype (Expression (Declaration_Node (gnat_entity))))); else - gnu_size = max_size (TYPE_SIZE (gnu_type), true); + { + gnu_size = max_size (TYPE_SIZE (gnu_type), true); + mutable_p = true; + } } /* If the size is zero bytes, make it one byte since some linkers have @@ -928,7 +932,11 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) If we have a template initializer only (that we made above), pretend there is none and rely on what build_allocator creates again anyway. Otherwise (if we have a full initializer), get - the data part and feed that to build_allocator. */ + the data part and feed that to build_allocator. + + If we are elaborating a mutable object, tell build_allocator to + ignore a possibly simpler size from the initializer, if any, as + we must allocate the maximum possible size in this case. */ if (definition) { @@ -959,7 +967,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) gnat_entity); gnu_expr = build_allocator (gnu_alloc_type, gnu_expr, gnu_type, - 0, 0, gnat_entity, false); + 0, 0, gnat_entity, mutable_p); } else { @@ -1104,7 +1112,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition) exception handler, we must force this variable in memory to suppress an invalid optimization. */ if (Has_Nested_Block_With_Handler (Scope (gnat_entity)) - && Exception_Mechanism != GCC_ZCX) + && Exception_Mechanism != Back_End_Exceptions) TREE_ADDRESSABLE (gnu_decl) = 1; /* Back-annotate the Alignment of the object if not already in the -- cgit v1.1