From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Cc: | Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
Subject: | Pointer subtraction with a null pointer |
Date: | 2022-03-26 16:04:54 |
Message-ID: | 48826.1648310694@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Several of Andres' buildfarm animals have recently started to whine
that "performing pointer subtraction with a null pointer has undefined
behavior" for assorted places in freepage.c.
From a mathematical standpoint, this astonishes me: "x - 0 = x" is a
tautology. So I'm a bit inclined to say "you're full of it" and disable
-Wnull-pointer-subtraction. On the other hand, all of the occurrences
are in calls of relptr_store with a constant-NULL third argument.
So we could silence them without too much pain by adjusting that macro
to special-case NULL. Or maybe we should change these call sites to do
something different, because this is surely abusing the intent of
relptr_store.
Thoughts?
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Matthias van de Meent | 2022-03-26 16:12:05 | Re: Invalid comment in ParallelQueryMain |
Previous Message | Julien Rouhaud | 2022-03-26 16:01:17 | Invalid comment in ParallelQueryMain |