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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2024-02-03

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Due to the aliasing rules for valarrays and slices, I think it would be
undefined to assign a gslice to itself. So the overhead of checking for
something that should never happen to avoid a redundant increment/decrement
pair is a poor trade off. Letting it redundantly inc/dec the reference count is
safe and correct for self-assignment, without adding a branch to handle
"impossible" cases.

I suppose we can add a comment to that effect.

Reply via email to