[PATCH] Disallow side-effects in inline asm operands unless < or > constraint is used (PR middle-end/44492)

Jeff Law law@redhat.com
Thu Jun 24 18:24:00 GMT 2010


On 06/20/10 09:25, Jakub Jelinek wrote:
> On Sun, Jun 20, 2010 at 11:16:15AM -0400, Hans-Peter Nilsson wrote:
>    
>> On Sun, 20 Jun 2010, Jakub Jelinek wrote:
>>      
>>> Anyway, I guess I can live with not adding _ and saying that side-effects in
>>> inline-asm memory is not allowed unless the constraint contains<  or>.
>>> Then PRE_MODIFY resp. POST_MODIFY would be allowed in
>>> "m<>" or even just "m<" or "m>", assuming PRE_MODIFY resp. POST_MODIFY
>>> is allowed in memory_address.
>>>
>>> The implementation would be roughly the same as the patch I've posted, just
>>> </>  would set incdec_ok instead of _.
>>>        
>> And a much shorter documentation patch! :)
>> (I guess mentioning that asm operands will not have side-effects
>> unless<  or>  are explicitly mentioned would be right.)
>>
>>      
>>> Advantage of doing it that way is backwards compatibility, "m<>" can be used
>>> even with older gccs.
>>>
>>> If you prefer to do it that way, I can write a patch.
>>>        
>> IMHO that's preferable, unless there's a known specific need for
>> what "_m" brings in addition to "m<>" as suggested above.
>>      
> Here is a new patch.  Ok for trunk?
>
> 2010-06-20  Jakub Jelinek<jakub@redhat.com>
>
> 	PR middle-end/44492
> 	* recog.h (struct recog_data): Add is_asm field.
> 	* recog.c (asm_operand_ok, constrain_operands): If neither<  nor>  is
> 	present in constraints of inline-asm operand and memory operand
> 	contains {PRE,POST}_{INC,DEC,MODIFY}, return 0.
> 	(extract_insn): Initialize recog_data.is_asm.
> 	* doc/md.texi (Constraints): Document operand side-effect rules.
>
> 	* g++.dg/torture/pr44492.C: New test.
>    
OK.

jeff



More information about the Gcc-patches mailing list