This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Q about Ada and value ranges in types
- From: Diego Novillo <dnovillo at redhat dot com>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 2 May 2005 11:25:32 -0400
- Subject: Q about Ada and value ranges in types
I am tracking an ICE in VRP that triggers only in Ada. Given
this:
1 D.1480_32 = nam_30 - 300000361;
2 if (D.1480_32 <= 1) goto <L112>; else goto <L52>;
3 <L112>:;
4 D.1480_94 = ASSERT_EXPR <D.1480_32, D.1480_32 <= 1>;
5 goto <bb 50> (<L57>);
When visiting statemen #4, VRP tries to create the range [-INF, 1]
for name D.1480_94. However, the type of D.1480 is:
(gdb) ptu type
const types__name_id___XDLU_300000000__399999999
<integer_type 0xf6f3f360 types__name_id___XDLU_300000000__399999999
type <integer_type 0xf6f3cec4 types__Tname_idB sizes-gimplified visited SI
[ ... ]
min <integer_cst 0xf6f40060 300000000>
max <integer_cst 0xf6f40090 399999999>
RM size <integer_cst 0xf6ee13f0 32>>
So, for this type -INF is 300000000, and thus the range that we
try to create is [300000000, 1] which is invalid.
My question is, is Ada emitting an always-false predicate in line
#2? Or is it a bug? What would happen if nam_30 (also of the
same type) was 300000000?
If the Ada language allows that kind of runtime check, then my
fix to VRP will be different. On examining 'D.1480_32 = name_30
- 300000361' we could create the range [300000000, 399999999] for
D.1480_32 and fold statement #2 directly.
Thanks. Diego.