This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] diagnose unsupported uses of hardware register variables (PR 88000)


Hi,

On Thu, 15 Nov 2018, Alexander Monakov wrote:

> Reading the documentation certainly does not make that impression to me. 
> In any case, can you elaborate a bit further please:
> 
> 1. Regarding the comparison to 'volatile' qualifier.  Suppose you have an
> automatic variable 'int v;' in a correct program.  The variable is only used
> for some arithmetic, never passed to asms, does not have its address taken.

I should have been more precise, I meant volatile and mapped to some 
device memory.  I.e. a register variable is never automatic in that sense.  
Every read can return different values even without intervening changes in 
source code.

> 2. Are testcases given in PR 87984 valid? Quoting the latest example:
> 
> int f(void)
> {
>     int o=0, i;
>     for (i=0; i<3; i++) {
>         register int a asm("eax");
>         a = 1;
>         asm("add %1, %0" : "+r"(o) : "r"(a));
>         asm("xor %%eax, %%eax" ::: "eax");
>     }
>     return o;
> }

Which is indeed what happens here.

> This follows both your model

Not really, it ignores the fact that 'a' can change at any time, which is 
what happens.

> and the documentation to the letter, and yet will return 1 rather than 
> 3.
> 
> I disagree that it is practical to implement your model on GIMPLE.

I claim that that is what is implemented right now.


Ciao,
Michael.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]