[PATCH] riscv: Drop const annotation for sp

Maciej W. Rozycki macro at orcam.me.uk
Tue Mar 30 21:51:48 BST 2021


On Mon, 29 Mar 2021, Palmer Dabbelt wrote:

> The patch here is correct.  According to the GCC manual: "Do not use 
> type qualifiers such as const and volatile, as the outcome may be 
> contrary to expectations."  It doesn't mention in what way "const" may 
> provide an unexpected outcome, but that's probably why I didn't have it 
> the first time (despite us only reading the variable).  I must have 
> forgotten about that when I saw the patch go by.

 See GCC PR c/85745 and PR target/86673.  It probably does not apply to 
global asm variables though, not at least in the way described (IMHO it 
doesn't make sense either, as `sp' surely isn't constant).

 HTH,

  Maciej



More information about the linux-riscv mailing list