https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113293

--- Comment #4 from KBDeveloper <dories.spirits_0p at icloud dot com> ---
(In reply to Alexander Monakov from comment #3)
> (In reply to KBDeveloper from comment #2)
> > 
> > Ah, that makes sense. I had assumed that taking the address of arg would
> > force gcc to store it in memory somewhere. 
> > Is there a reason why gcc then allocates 8 bytes on the stack and fills r1
> > with sp - #7? Or is what I had just UB and gcc can do whatever?
> 
> The compiler allocates stack memory for 'arg' and passes the address of
> 'arg' to the asm; it is necessary in case the asm does something with it
> without reading 'arg' itself. One example would be installing a hardware
> watchpoint on that memory location.

That makes sense. Thanks for the explanation (and your time!)

Reply via email to