HTEC Public

Hi,

Could you please let us know if you have any comments
on the latest reply on this patch?

Kind regards,
Aleksandar Rakic

________________________________________
From: Aleksandar Rakic <aleksandar.ra...@htecgroup.com>
Sent: Wednesday, May 14, 2025 3:55 PM
To: Jeff Law; gcc-patches@gcc.gnu.org
Cc: Djordje Todorovic; c...@mips.com
Subject: Re: [PATCH 11/61] Fix unsafe comparison against stack_pointer_rtx

Hi,

> > GCC can modify a rtx which was created using stack_pointer_rtx.
> > This means that just doing a straight address comparision of a rtx
> > against stack_pointer_rtx to see whether it is the stack pointer
> > register will not be correct in all cases.
> Umm, no.  There is one and only one stack_pointer_rtx.  If something is
> modifying stack_pointer_rtx, then that's a bug.  This feels like it's
> papering over a problem elsewhere.  At the least it would need a better
> explanation of how/why you're getting addresses that reference the same
> hard register as the stack pointer, but which aren't stack_pointer_rtx.

> I vaguely recall a problem in this space from regrename.cc, but I
> thought we fixed that long ago.

> Jeff

I searched the targets other than the MIPS target and found out that
there are the commits 74dc3e9 and c21242e that test for a REGNO instead
of comparing the rtx to stack_pointer_rtx directly.

Also, I found that the commit d60e544 states the following:
"We can't just compare with STACK_POINTER_RTX because the reference to
the stack pointer might be in some other mode. In particular, an explict
clobber in an asm statement will result in a QImode clober."
I am wondering if this could be a satisfying explanation.

Kind regards,
Aleksandar

Reply via email to