[Mesa-dev] [PATCH 1/5] gallium/u_inlines: fix member access within null pointer

Marek Olšák maraeo at gmail.com
Wed Feb 8 22:58:20 UTC 2017


On Wed, Feb 8, 2017 at 8:37 PM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> On 08.02.2017 20:17, Marek Olšák wrote:
>>
>> The no_sanitize attribute seems to be the most acceptable approach.
>
>
> I disagree. gcc produces the same code even with just -O, and the ?: version
> very clearly avoids undefined behavior. If we could get into the habit of
> regularly running tests with the various sanitizers enabled, it would
> definitely allow us to catch some bugs sooner.
>
> Though the example Bartosz produced is still overly conservative, the "safe"
> code still has an unnecessary `if (pptr)` (which gcc actually optimizes away
> based on the fact that pptr was previously dereferenced...).

OK whatever. No hard feelings.

Marek


More information about the mesa-dev mailing list