2014-12-01 14:11 GMT+03:00 Richard Biener <richard.guent...@gmail.com>:
> On Mon, Dec 1, 2014 at 10:33 AM, Ilya Enkovich <enkovich....@gmail.com> wrote:
>> Hi,
>>
>> This patch fixes ICE in chkp_find_bound_slots_1 by checking for non constant 
>> values in array domain.  Bootstrapped on x86_64-unknown-linux-gnu with Ada.  
>> gnat.dg/derived_aggregate.adb is a new pass.  OK for trunk?
>
> Ok.
>
> But now I'm curious - bounds-checking wasn't supposed to be used
> for Ada but now it is?

There is a chkp_type_bounds_count call in i386 ABI code which is
executed even for not instrumented code.  It happens because target
doesn't know whether call is instrumented or not and assumes bounds
may be passed.  It means this function must handle all possible types,
not only expected for C code.

Ilya

>
> Thanks,
> Richard.
>
>> Thanks,
>> Ilya
>> --
>> 2014-12-01  Ilya Enkovich  <ilya.enkov...@intel.com>
>>
>>         PR target/64055
>>         * tree-chkp.c (chkp_find_bound_slots_1): Allow non constant
>>         values in array domain.
>>
>>
>> diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c
>> index 3e38691..6665ce2 100644
>> --- a/gcc/tree-chkp.c
>> +++ b/gcc/tree-chkp.c
>> @@ -1565,7 +1565,9 @@ chkp_find_bound_slots_1 (const_tree type, bitmap 
>> have_bound,
>>        HOST_WIDE_INT esize = TREE_INT_CST_LOW (TYPE_SIZE (etype));
>>        unsigned HOST_WIDE_INT cur;
>>
>> -      if (!maxval || integer_minus_onep (maxval))
>> +      if (!maxval
>> +         || TREE_CODE (maxval) != INTEGER_CST
>> +         || integer_minus_onep (maxval))
>>         return;
>>
>>        for (cur = 0; cur <= TREE_INT_CST_LOW (maxval); cur++)

Reply via email to