summaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/misc.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2010-04-17 14:16:36 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2010-04-17 14:16:36 +0000
commit3e70070e2728b17a16ceef391b6c74911db31065 (patch)
tree7bfc84cbad5fe9e5614c7e2adf4638dcbff4f0ee /gcc/ada/gcc-interface/misc.c
parent647e1499c83eb4b92b27f361fc3a5854c93576a0 (diff)
* uintp.h (UI_Lt): Declare.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Do the size computation in sizetype. <E_Array_Subtype>: Use unified handling for all index types. Do not generate MAX_EXPR-based expressions, only COND_EXPR-based ones. Add bypass for PATs. (annotate_value): Change test for negative values. (validate_size): Apply test for negative values on GNAT nodes. (set_rm_size): Likewise. * gcc-interface/misc.c (gnat_init): Set unsigned types for sizetypes. * gcc-interface/utils.c (rest_of_record_type_compilation): Change test for negative values. (max_size) <MINUS_EXPR>: Do not reassociate a COND_EXPR on the LHS. (builtin_type_for_size): Adjust definition of signed_size_type_node. * gcc-interface/utils2.c (compare_arrays): Optimize comparison of lengths against zero. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158466 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/gcc-interface/misc.c')
-rw-r--r--gcc/ada/gcc-interface/misc.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c
index f3e7b1b74827..6923105afa24 100644
--- a/gcc/ada/gcc-interface/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -391,13 +391,16 @@ gnat_init (void)
/* Do little here, most of the standard declarations are set up after the
front-end has been run. Use the same `char' as C, this doesn't really
matter since we'll use the explicit `unsigned char' for Character. */
- build_common_tree_nodes (flag_signed_char, true);
-
- /* In Ada, we use a signed type for SIZETYPE. Use the signed type
- corresponding to the width of Pmode. In most cases when ptr_mode
- and Pmode differ, C will use the width of ptr_mode for SIZETYPE.
- But we get far better code using the width of Pmode. */
- size_type_node = gnat_type_for_mode (Pmode, 0);
+ build_common_tree_nodes (flag_signed_char, false);
+
+ /* In Ada, we use the unsigned type corresponding to the width of Pmode as
+ SIZETYPE. In most cases when ptr_mode and Pmode differ, C will use the
+ width of ptr_mode for SIZETYPE, but we get better code using the width
+ of Pmode. Note that, although we manipulate negative offsets for some
+ internal constructs and rely on compile time overflow detection in size
+ computations, using unsigned types for SIZETYPEs is fine since they are
+ treated specially by the middle-end, in particular sign-extended. */
+ size_type_node = gnat_type_for_mode (Pmode, 1);
set_sizetype (size_type_node);
TYPE_NAME (sizetype) = get_identifier ("size_type");