Re: undefined-behavior obstack.c:139

2023-12-02 Thread Andreas F. Borchert
On Sat, Dec 02, 2023 at 09:50:33AM +0100, Bruno Haible wrote: > I still don't know whether it's OK to have pointers to arrays with > 0 elements (which are not "array objects", since "objects" are non- > empty (§ 6.2.6.1.(2))). From § 6.7.6.2 about array declarators: If the expression is a cons

Re: undefined-behavior obstack.c:139

2023-12-02 Thread Bruno Haible
Paul Eggert wrote: > > Indeed, this sentence appears to forbid ((char *) NULL) + something. > > Yes. However, Gnulib code can still use ((char *) NULL) + something) > because the Gnulib portability guidelines allow it. > > The issue with clang false positives is covered here: > > https://www.gn

Re: undefined-behavior obstack.c:139

2023-12-02 Thread Bruno Haible
Andreas F. Borchert wrote: > In summary, null pointer constants are not pointers to an object > or an element of an array object and thereby must not be used > for pointer arithmetic. Thanks for the explanations. I still don't know whether it's OK to have pointers to arrays with 0 elements (which