On 07/26/2018 05:18 AM, Richard Biener wrote:
> On Thu, Jul 26, 2018 at 12:29 PM Alexander Monakov <amona...@ispras.ru> wrote:
>>
>> Hi,
>>
>> when using explicit register variables ('register int foo asm("%ebp");'),
>> using const/volatile type qualifiers on the declaration does not result in
>> the logically expected effect.
>>
>> The main issue is that gcc-8 got "better" at propagating initializers of
>> 'register const' variables to their uses in asm operands, losing the
>> association with the register and thus causing the operand to
>> unexpectedly appear in some other register. This caused build issues for
>> the Linux kernel and was reported a couple of times in the GCC Bugzilla.
>>
>> This patch adds a few lines to the documentation to say that qualifiers
>> won't work as expected. OK for trunk?
> 
> Looks ok to me.  Maybe we should change FEs to ignore those
> qualifiers on explicit register variables and emit a warning like
> 
> warning: const/volatile qualifier ignored on X
It'd certainly help catch these kinds of issues earlier rather than
seeing the assembler barf when the constant gets propagated or some
unexpected optimization.

jeff

Reply via email to