[Top][All Lists]

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

Re: malloca, freea are not thread-safe

From: Paul Eggert
Subject: Re: malloca, freea are not thread-safe
Date: Sun, 4 Feb 2018 08:58:50 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

Bruno Haible wrote:
Hi Paul,

By the way, why write "if __GNUC__ >= 5 && !defined __cplusplus &&
!defined __clang__" instead of "ifdef __CHKP__"? The latter is easier to

I couldn't find any documentation for this __CHKP__ macro.

It's not documented in the GCC manual. I found documentation for it here:


This points to a freely-readable PDF.

The code that I committed does not have such "bad" pointers in intermediate
expressions either. It computes a valid pointer, converts it to uintptr_t,
does some arithmetic on it, and then converts back to a pointer. Since the
resulting pointer is in the malloc'ed range, it is valid.

Ah, sorry, I was thinking about my translation of that into code that did not convert pointers back from uintptr_t.

reply via email to

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