This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Simplify ptr - 0


On Wed, 22 Nov 2017, Jakub Jelinek wrote:

On Wed, Nov 22, 2017 at 06:34:08PM +0100, Marc Glisse wrote:
Hello,

I hadn't implemented this simplification because I think it is invalid code,
but apparently people do write it, so we might as well handle it sensibly.
This also happens to work around PR 83104 (already fixed).

bootstrap+regtest on powerpc64le-unknown-linux-gnu.

I guess we'll need to disable it for -fsanitize=pointer-subtraction
once/if it makes it in, because it should be still diagnosed as invalid.

I am not sure you'll need to disable it. From what I've seen, the patch inserts a call to BUILT_IN_ASAN_POINTER_SUBTRACT before the POINTER_DIFF_EXPR is created, and I don't see why simplifying POINTER_DIFF_EXPR would affect that call. But then again, I don't know how the sanitizers work, so I can easily misinterpret things.

--
Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]