diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2009-04-22 22:32:54 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2009-04-22 22:32:54 +0000 |
commit | b7babd5d428f7439b7cd83077b7c3d902570e0ea (patch) | |
tree | beedd09a228d7c271f4269d3c601ccd2aa414c7e /gcc/ada | |
parent | 5225a1389d0058ac8f64153efa64c8e07ec13c9a (diff) | |
download | gcc-b7babd5d428f7439b7cd83077b7c3d902570e0ea.zip gcc-b7babd5d428f7439b7cd83077b7c3d902570e0ea.tar.gz gcc-b7babd5d428f7439b7cd83077b7c3d902570e0ea.tar.bz2 |
utils2.c (build_binary_op): If operation's type is an enumeral or a boolean type...
* gcc-interface/utils2.c (build_binary_op) <PLUS_EXPR>: If operation's
type is an enumeral or a boolean type, change it to an integer type
with the same mode and signedness.
From-SVN: r146625
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/utils2.c | 18 |
2 files changed, 17 insertions, 7 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index acdc11c..6f31942 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,11 @@ 2009-04-22 Eric Botcazou <ebotcazou@adacore.com> + * gcc-interface/utils2.c (build_binary_op) <PLUS_EXPR>: If operation's + type is an enumeral or a boolean type, change it to an integer type + with the same mode and signedness. + +2009-04-22 Eric Botcazou <ebotcazou@adacore.com> + * gcc-interface/utils.c (create_var_decl_1): Do not emit debug info for an external constant whose initializer is not absolute. diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c index 77a0389..d6b7d68 100644 --- a/gcc/ada/gcc-interface/utils2.c +++ b/gcc/ada/gcc-interface/utils2.c @@ -6,7 +6,7 @@ * * * C Implementation File * * * - * Copyright (C) 1992-2008, Free Software Foundation, Inc. * + * Copyright (C) 1992-2009, Free Software Foundation, Inc. * * * * GNAT is free software; you can redistribute it and/or modify it under * * terms of the GNU General Public License as published by the Free Soft- * @@ -1010,11 +1010,15 @@ build_binary_op (enum tree_code op_code, tree result_type, case PLUS_EXPR: case MINUS_EXPR: - /* Avoid doing arithmetics in BOOLEAN_TYPE like the other compilers. - Contrary to C, Ada doesn't allow arithmetics in Standard.Boolean - but we can generate addition or subtraction for 'Succ and 'Pred. */ - if (operation_type && TREE_CODE (operation_type) == BOOLEAN_TYPE) - operation_type = left_base_type = right_base_type = integer_type_node; + /* Avoid doing arithmetics in ENUMERAL_TYPE or BOOLEAN_TYPE like the + other compilers. Contrary to C, Ada doesn't allow arithmetics in + these types but can generate addition/subtraction for Succ/Pred. */ + if (operation_type + && (TREE_CODE (operation_type) == ENUMERAL_TYPE + || TREE_CODE (operation_type) == BOOLEAN_TYPE)) + operation_type = left_base_type = right_base_type + = gnat_type_for_mode (TYPE_MODE (operation_type), + TYPE_UNSIGNED (operation_type)); /* ... fall through ... */ @@ -2199,7 +2203,7 @@ fill_vms_descriptor (tree expr, Entity_Id gnat_formal, Node_Id gnat_actual) add_stmt (build3 (COND_EXPR, void_type_node, build_binary_op (GE_EXPR, long_integer_type_node, convert (long_integer_type_node, - addr64expr), + addr64expr), malloc64low), build_call_raise (CE_Range_Check_Failed, gnat_actual, N_Raise_Constraint_Error), |