https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93974

--- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Richard Sandiford said on this PR, probably lost due to sourceware migration:

Sorry for the slow reply, been a bit of a hectic week.                          

I think both fixes would be valid.  Like you say, the address                   
parsing code isn't yet ready to handle addresses that apply                     
an offset *before* the address "mutations".  That's because                     
no target has yet wanted to support such an address.  So as                     
things stand, the current address is not valid and shouldn't                    
have been created.                                                              

In some ways this is similar to creating an invalid highpart                    
subreg for the upper word of a doubleword vector hard register,                 
or a subreg that falls foul of some simplify_subreg_regno rule.                 
The RA has code to avoid doing that, see init_subregs_of_mode                   
and its users.  We could do something similar here for                          
REG_EQUIV MEMs.  One option would be to key off whether                         
strip_address_mutations is a no-op on the address.                              
Another would be to check whether each required sub-MEM                         
is valid for its mode and offset.  The latter would be                          
more elaborate but might produce better code in general,                        
not just for cases like this.                                                   

Like you say in comment 4, even the zero-offset half isn't                      
actually a valid address for PowerPC, so either of the two                      
options should give better code as well as fixing the bug.                      

On the other hand, the idea was always that address_info                        
and its users could be extended if new targets have new                         
requirements.  So if we want to make this operation valid                       
then that would be OK too.

Reply via email to