aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/trans.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2008-03-10 19:26:35 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2008-03-10 19:26:35 +0000
commite1e7141cf3128d384dca902928d98a47cb57dddd (patch)
treedc98e5c42a55d7c4388ee9c0100c8cc34396efaa /gcc/ada/trans.c
parent725c2d321c429ef8f09b8474e0f3d693c6a5d1d8 (diff)
downloadgcc-e1e7141cf3128d384dca902928d98a47cb57dddd.zip
gcc-e1e7141cf3128d384dca902928d98a47cb57dddd.tar.gz
gcc-e1e7141cf3128d384dca902928d98a47cb57dddd.tar.bz2
trans.c (emit_range_check): Do not emit the check if the base type of the expression is the type against...
* trans.c (emit_range_check): Do not emit the check if the base type of the expression is the type against which its range must be checked. From-SVN: r133083
Diffstat (limited to 'gcc/ada/trans.c')
-rw-r--r--gcc/ada/trans.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/ada/trans.c b/gcc/ada/trans.c
index acf4de3..4cfd225 100644
--- a/gcc/ada/trans.c
+++ b/gcc/ada/trans.c
@@ -5757,6 +5757,11 @@ emit_range_check (tree gnu_expr, Entity_Id gnat_range_type)
tree gnu_high = TYPE_MAX_VALUE (gnu_range_type);
tree gnu_compare_type = get_base_type (TREE_TYPE (gnu_expr));
+ /* If GNU_EXPR has GNAT_RANGE_TYPE as its base type, no check is needed.
+ This can for example happen when translating 'Val or 'Value. */
+ if (gnu_compare_type == gnu_range_type)
+ return gnu_expr;
+
/* If GNU_EXPR has an integral type that is narrower than GNU_RANGE_TYPE,
we can't do anything since we might be truncating the bounds. No
check is needed in this case. */