[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Dereference of undefined pointer value in conftest.c
From: |
Tomas Carnecky |
Subject: |
Re: Dereference of undefined pointer value in conftest.c |
Date: |
Mon, 7 Dec 2009 10:00:43 +0100 |
On Dec 7, 2009, at 7:36 AM, Ralf Wildenhues wrote:
> Hello Tomas,
>
> * Tomas Carnecky wrote on Sun, Dec 06, 2009 at 09:10:47PM CET:
>> I just ran the clang static analyzer on the xserver configure script and
>> it reported a few issues. Most of them were dead assignments/increments,
>> but there also was one dereference of an undefined pointer value. I
>> don't know which tests the conftest.c belongs to, but I doubt it's to
>> test if an application can safely write to unknown memory ;). The test
>> contains the following code:
>
> The code is from AC_C_CONST. If your package requires anything near a
> C89 (or newer) compiler, then you don't need and shouldn't use
> AC_C_CONST. Compilers not grokking 'const' are old (I don't know how
> old, but I've never met one).
>
> Last time we looked at this code because someone reported oddities, we
> concluded that we shouldn't change the test because we had no way of
> verifying whether the test would still expose the documented issue
> afterwards. In general, you are of course right that tests shouldn't
> have undefined behavior, but sometimes that is unavoidable.
I see. It was interesting to run the configure script through clang and see
which warnings it would generate. I'll just ignore those in the future.
tom