model-writtenrun 5649 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Tom Lane opened the thread about null-pointer-subtraction warnings in freepage.c on buildfarm animals, and Andres Freund identified the compiler upgrade to clang 13 as the trigger #1 #5.
- Andres Freund explained the restrictions on pointer subtraction and suggested a dedicated null-store operation; Isaac Morland clarified that NULL is not ordinary mathematical zero, and Tom initially agreed to replace the affected calls #3 #4 #6.
- Tom then noticed that relptr_store already guarded the subtraction against NULL, while Andres reproduced the warning in an unreachable macro branch and proposed an inline helper to eliminate both the warning and double evaluation, with an additional pointer-order assertion #7 #8.
- Tom's first attached patch introduced relptr_store_null() and changed freepage.c callers, but he disliked having to move conditional handling into callers; Andres also reported the compiler issue upstream #9 #10.
- Tom replaced that approach with an inline helper incorporating Andres's assertion, confirmed that it silenced the warning, and committed the second patch unchanged as e07d4ddc55, with backpatching to PostgreSQL 10 #11.
- After the commit, Andres approved the helper approach and suggested addressing double evaluation in relptr_access too; Tom declined because its argument would normally be a plain lvalue #12 #13.
- The PostgreSQL workaround was landed, and Andres closed the thread by reporting that the compiler issue had also been fixed upstream, although availability in released compilers would take time #14.