summaryrefslogtreecommitdiff
path: root/gcc/ada/decl.c
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-01 11:51:54 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2004-09-01 11:51:54 +0000
commit284faf8b1b957275c50d243666ba898a77aa3785 (patch)
tree9dd290825d6a2ee12dbbf7d949cc7b983baac8bd /gcc/ada/decl.c
parent992845dfe8f70900dcdf5362211907164e842366 (diff)
downloadgcc-284faf8b1b957275c50d243666ba898a77aa3785.tar.gz
2004-08-31 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* misc.c (gnat_print_type): Use TYPE_RM_SIZE_NUM. * trans.c (struct stmt_group): Delete field GLOBAL. (gnat_init_stmt_group): Do not initialize it. (call_to_gnu): Use save_expr, not protect_multiple_eval. (Exception_Handler_to_gnu_sjlj): Call build_int_cst, not build_int_2 (gnat_to_gnu, case N_Character_Literal, N_String_Literal): Likewise. (gnat_to_gnu, case N_Compilation_Unit): Do not set GLOBAL in stmt group. (start_stmt_group): Likewise. (add_stmt, add_decl_expr): Rework handling of global DECL_EXPRs. * utils2.c (ggc.h): Include. (build_call_raise): Call build_int_cst, not build_int_2. * utils.c (gnat_init_decl_processing): Fix arg to build_common_tree_nodes. (create_subprog_type): Do not use SET_TYPE_CI_CO_LIST. (gnat_define_builtin): Set built_in_decls. (init_gigi_decls): Call build_int_cst, not build_int_2. * ada-tree.h (struct lang_decl, struct lang_type): Field is type tree. (GET_TYPE_LANG_SPECIFIC, SET_TYPE_LANG_SPECIFIC): New macros. (GET_DECL_LANG_SPECIFIC, SET_DECL_LANG_SPECIFIC): Likewise. (TYPE_CI_CO_LIST, SET_TYPE_CI_CO_LIST, TYPE_MODULE, SET_TYPE_MODULE): Use them. (TYPE_INDEX_TYPE, SET_TYPE_INDEX_TYPE, TYPE_DIGITS_VALUE): Likewise. (SET_TYPE_DIGITS_VALUE, TYPE_UNCONSTRAINED_ARRAY): Likewise. (SET_TYPE_UNCONSTRAINED_ARRAY, TYPE_ADA_SIZE, SET_TYPE_ADA_SIZE): Likewise. (TYPE_ACTUAL_BOUNDS, SET_TYPE_ACTUAL_BOUNDS): Likewise. (DECL_CONST_CORRESPONDING_VAR, SET_DECL_CONST_CORRESPONDING_VAR): Likewise. (DECL_ORIGINAL_FIELD, SET_DECL_ORIGINAL_FIELD): Likewise. (TYPE_RM_SIZE_INT, TYPE_RM_SIZE_ENUM, SET_TYPE_RM_SIZE_ENUM): Deleted. (TYPE_RM_SIZE_NUM): New macro. (TYPE_RM_SIZE): Modified to use above. * cuintp.c: (build_cst_from_int): New function. (UI_To_gnu): Use it. * decl.c (gnat_to_gnu_entity): Use TYPE_RM_SIZE_NUM. (make_type_from_size): Avoid changing TYPE_UNSIGNED of a type. (gnat_substitute_in_type, case ARRAY_TYPE): If old had a MIN_EXPR for the size, copy it into new. 2004-08-31 Robert Dewar <dewar@gnat.com> * exp_ch6.adb (Expand_Call): Properly handle validity checks for packed indexed component where array is an IN OUT formal. This generated garbage code previously. * gnat_ugn.texi: Document -fverbose-asm * gnat-style.texi: Minor updates (note that boolean constants and variables are joined with AND/OR rather than short circuit forms). 2004-08-31 Ed Schonberg <schonberg@gnat.com> * exp_util.adb (Safe_Unchecked_Type_Conversion): Conversion is safe if it is an upward conversion of an untagged type with no representation change. 2004-08-31 Thomas Quinot <quinot@act-europe.fr> * rtsfind.ads: Move RCI_Subp_Info and RCI_Subp_Info_Array to System.Partition_Interface. * checks.adb (Apply_Access_Checks): Do not generate checks when expander is not active (but check for unset reference to prefix of dereference). * sem_prag.adb (Analyze_Pragma, case Pragma_Debug): Uniformly rewrite pragma Debug as an if statement with a constant condition, for consistent treatment of entity references contained within the enclosed procedure call. 2004-08-31 Vincent Celier <celier@gnat.com> * bindgen.adb: (Set_EA_Last): New procedure (Gen_Exception_Table_Ada, Gen_Exception_Table_C): Use new procedure Set_EA_Last. (Gen_Adafinal_Ada): If no finalization, adafinal does nothing (Gen_Output_File_Ada): Always call Gen_Adafinal_Ada, so that SAL can be linked without errors. (Gen_Exception_Table_Ada): Correct bugs when generating code for arrays ST and EA. (Gen_Exception_Table_C): Correct same bugs * vms_data.ads: Add new qualifier /VERBOSE_ASM to GCC_Switches * g-os_lib.adb (Normalize_Pathname.Get_Directory): When Dir is empty, on Windows, make sure that the drive letter is in upper case. * g-os_lib.ads (Normalize_Pathname): Add a comment to indicate that on Windows, when the drive letter is added and Case_Sensitive is True, the drive letter is forced to upper case. * mlib-tgt-irix.adb (Build_Dynamic_Library): Transfer all -lxxx options to Options_2 for the call to MLib.Utl.Gcc. * bld.adb (Put_Include_Project): Use '/', not '\' on Windows as directory separator when defining BASE_DIR. 2004-08-19 Pascal Obry <obry@gnat.com> * gprcmd.adb (Extend): Do not output trailing directory separator. This is not needed and it confuses Windows GNU/make which does not report directory terminated by a slash as a directory. (gprcmd): Idem for "pwd" internal command. * Makefile.generic: Use __GPRCOLON__ instead of pipe character in target names rewrite to fix regressions with recent version of GNU/make. Starting with GNU/make 3.80 the pipe character was not handled properly anymore. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@86883 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/decl.c')
-rw-r--r--gcc/ada/decl.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/gcc/ada/decl.c b/gcc/ada/decl.c
index a3a70002706..33bbbb1dd61 100644
--- a/gcc/ada/decl.c
+++ b/gcc/ada/decl.c
@@ -1350,7 +1350,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
tree gnu_field_type = gnu_type;
tree gnu_field;
- TYPE_RM_SIZE_INT (gnu_field_type)
+ TYPE_RM_SIZE_NUM (gnu_field_type)
= UI_To_gnu (RM_Size (gnat_entity), bitsizetype);
gnu_type = make_node (RECORD_TYPE);
TYPE_NAME (gnu_type) = create_concat_name (gnat_entity, "LJM");
@@ -5978,9 +5978,9 @@ set_rm_size (Uint uint_size, tree gnu_type, Entity_Id gnat_entity)
/* Otherwise, set the RM_Size. */
if (TREE_CODE (gnu_type) == INTEGER_TYPE
&& Is_Discrete_Or_Fixed_Point_Type (gnat_entity))
- TYPE_RM_SIZE_INT (gnu_type) = size;
+ TYPE_RM_SIZE_NUM (gnu_type) = size;
else if (TREE_CODE (gnu_type) == ENUMERAL_TYPE)
- SET_TYPE_RM_SIZE_ENUM (gnu_type, size);
+ TYPE_RM_SIZE_NUM (gnu_type) = size;
else if ((TREE_CODE (gnu_type) == RECORD_TYPE
|| TREE_CODE (gnu_type) == UNION_TYPE
|| TREE_CODE (gnu_type) == QUAL_UNION_TYPE)
@@ -5998,6 +5998,7 @@ make_type_from_size (tree type, tree size_tree, bool biased_p)
{
tree new_type;
unsigned HOST_WIDE_INT size;
+ bool unsigned_p;
/* If size indicates an error, just return TYPE to avoid propagating the
error. Likewise if it's too large to represent. */
@@ -6017,20 +6018,20 @@ make_type_from_size (tree type, tree size_tree, bool biased_p)
&& TYPE_BIASED_REPRESENTATION_P (type))))
break;
+ biased_p |= (TREE_CODE (type) == INTEGER_TYPE
+ && TYPE_BIASED_REPRESENTATION_P (type));
+ unsigned_p = TYPE_UNSIGNED (type) || biased_p;
+
size = MIN (size, LONG_LONG_TYPE_SIZE);
- new_type = make_signed_type (size);
+ new_type
+ = unsigned_p ? make_unsigned_type (size) : make_signed_type (size);
TREE_TYPE (new_type) = TREE_TYPE (type) ? TREE_TYPE (type) : type;
TYPE_MIN_VALUE (new_type)
= convert (TREE_TYPE (new_type), TYPE_MIN_VALUE (type));
TYPE_MAX_VALUE (new_type)
= convert (TREE_TYPE (new_type), TYPE_MAX_VALUE (type));
- TYPE_BIASED_REPRESENTATION_P (new_type)
- = ((TREE_CODE (type) == INTEGER_TYPE
- && TYPE_BIASED_REPRESENTATION_P (type))
- || biased_p);
- TYPE_UNSIGNED (new_type)
- = TYPE_UNSIGNED (type) | TYPE_BIASED_REPRESENTATION_P (new_type);
- TYPE_RM_SIZE_INT (new_type) = bitsize_int (size);
+ TYPE_BIASED_REPRESENTATION_P (new_type) = biased_p;
+ TYPE_RM_SIZE_NUM (new_type) = bitsize_int (size);
return new_type;
case RECORD_TYPE:
@@ -6262,6 +6263,17 @@ gnat_substitute_in_type (tree t, tree f, tree r)
TYPE_CONVENTION_FORTRAN_P (new) = TYPE_CONVENTION_FORTRAN_P (t);
layout_type (new);
TYPE_ALIGN (new) = TYPE_ALIGN (t);
+
+ /* If we had bounded the sizes of T by a constant, bound the sizes of
+ NEW by the same constant. */
+ if (TREE_CODE (TYPE_SIZE (t)) == MIN_EXPR)
+ TYPE_SIZE (new)
+ = size_binop (MIN_EXPR, TREE_OPERAND (TYPE_SIZE (t), 1),
+ TYPE_SIZE (new));
+ if (TREE_CODE (TYPE_SIZE_UNIT (t)) == MIN_EXPR)
+ TYPE_SIZE_UNIT (new)
+ = size_binop (MIN_EXPR, TREE_OPERAND (TYPE_SIZE_UNIT (t), 1),
+ TYPE_SIZE_UNIT (new));
return new;
}