Help with reload and naked constant sum causing ICE

Andy H hutchinsonandy@aim.com
Mon May 26 15:39:00 GMT 2008


Hi,

I am am tracking down ICE bug in reload during global register allocation.

I have managed to find root of problem but I am not sure how it should 
work correctly. I would appreciate anyones advise on this.

ICE is from assert  in push_reload  to ensure that pseudos  have been 
replaced with hard register or constants. (reload.c  line 940 or so)
It fails because pseudo equivalent of constant is not (yet)  replaced 
for IN.

The sequence of event that causes this to occur is something like this.

1) Psuedo p68 is marked as equivalent to constant
reg_equiv_constant[68]=(symbol_ref:HI ("chk_fail_buf") [flags 0x40] 
<var_decl 0x7fe00000 chk_fail_buf>)

2) p68+2 is also needed
(plus:HI (reg/f:HI 68)
    (const_int 2 [0x2]))

3) find_reloads_address  is given p68+2 by find_reloads()

4)  p68+2 is  STRICTLY checked as memory address - and target rejects it 
as it has no outer constant and contains psuedo.
  if (strict_memory_address_p (mode, ad))

5) find_reloads_address then uses LEGITIMIZE_RELOAD_ADDRESS to fix problem

6) LEGITIMIZE_RELOAD_ADDRESS calls push_reload  to reload p68 using  
BASE_POINTER

7)ICE


I think there is something wrong at step 4  but according to manual  
address p68+2 should be rejected since it does not have outer constant 
wrapper.

<QUOTE>
Normally, constant addresses which are the sum of a |symbol_ref| and an 
integer are stored inside a |const| RTX to mark them as constant. 
Therefore, there is no need to recognize such sums specifically as 
legitimate addresses. Normally you would simply recognize any |const| as 
legitimate.

Usually |PRINT_OPERAND_ADDRESS| is not prepared to handle constant sums 
that are not marked with |const|. It assumes that a naked |plus| 
indicates indexing. If so, then you /mus/reject such naked constant sums 
as illegitimate addresses, so that none of them will be given to 
|PRINT_OPERAND_ADDRESS|.
// <QUOTE>

But I cannot find any const RTX wrappers being  applied. The rest of 
reload does not seem to expect a wrapper.

Perhaps LEGITIMIZE_RELOAD should fix problem - though that seems odd.

Can someone point in right direction? 

best regards

Andy






More information about the Gcc mailing list