bug-m4
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: undefined-behavior obstack.c:139


From: Marc Nieper-Wißkirchen
Subject: Re: undefined-behavior obstack.c:139
Date: Sun, 3 Dec 2023 10:17:07 +0100

Am So., 3. Dez. 2023 um 10:05 Uhr schrieb Paul Eggert <eggert@cs.ucla.edu>:
On 2023-12-02 01:04, Bruno Haible wrote:
> On the contrary, I will try to find and eliminate such alarms.

Please don't complicate and/or slow down shared Gnulib code just to
pacify this particular false alarm from Clang. The obstack fix was fine,
because it made obstack clearer and no slower. But we shouldn't have to
insert unnecessary "is the size zero?" checks merely to pacify the false
alarms.

I would suggest writing macros that encapsulate code like "NULL + 0" and replace the code with macro invocations.  On legacy systems, the macro would expand into the legacy code; on modern systems where checks like "is this zero size?" should be eliminated by the compiler, the macro would expand into the correct ISO C code.  This can also make the code more transparent as long as the macro has a self-describing name.
 
The right place to fix this problem is in Clang, not in Gnulib.

I don't think so.  As long as Clang implements ISO C, it is not Clang's problem but a problem of code that produces UB (in the technical sense).

Just my two cents, of course.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]