[Bug c/105294] restrict pointer - disagreement with specification

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 19 09:33:19 GMT 2022


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rguenth at gcc dot gnu.org

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
So for GCC r is based on x and s because we use "value based" based-on, that
the value of r changes when p changes shall not mean that this influences
aliasing.  So I agree that the C spec should change (changing 'p' does not
change the set of values 'r' can receive).

Note that GCC, when seeing that r can either be &x (not "restrict") or s
(restrict), makes '*r' effectively not covered by restrict so it relies
on the restrictness of 'p' to disambiguate.  We'd have to assign
restrict tags to each local variable to make it cover this case because
of the way we represent restrict.

I'd have to study llvm to see if they are doing sth more clever here.


More information about the Gcc-bugs mailing list