[PATCH] Fix PR77826

Marc Glisse marc.glisse@inria.fr
Thu Oct 6 18:44:00 GMT 2016

On Wed, 5 Oct 2016, Richard Biener wrote:

>> The following will fix PR77826, the issue that in match.pd matching
>> up two things uses operand_equal_p which is too lax about the type
>> of the toplevel entity (at least for integer constants).
>> Bootstrap / regtest pending on x86_64-unknown-linux-gnu.
> The following is what I have applied.
> Richard.
> 2016-10-05  Richard Biener  <rguenther@suse.de>
> 	PR middle-end/77826
> 	* genmatch.c (dt_operand::gen_match_op): Amend operand_equal_p
> 	with types_match for GIMPLE code gen to handle type mismatched
> 	constants properly.

I don't understand the disparity between generic and gimple here. Why let 
(char)1 and (long)1 match in generic but not in gimple? And there are 
probably several transformations in match.pd that could do with an update 
if constants don't match anymore. Or did I misunderstand what the patch 

> 	* match.pd ((X /[ex] A) * A -> X): Properly handle converted
> 	and constant A.

This regressed
int f(int*a,int*b){return 4*(int)(b-a);}

Marc Glisse

More information about the Gcc-patches mailing list