On Wed, 19 Apr 2023 at 14:51, Bernhard Reutner-Fischer
<[email protected]> wrote:
>
> On 19 April 2023 09:06:28 CEST, Lipeng Zhu via Fortran <[email protected]>
> wrote:
>
> >+#ifdef __GTHREAD_RWLOCK_INIT
> >+#define RWLOCK_DEBUG_ADD(rwlock) do { \
> >+ aio_rwlock_debug *n; \
> >+ n = malloc (sizeof(aio_rwlock_debug)); \
>
> My malloc can fail.
Sorry, i hit send too early.
Please use xmalloc as defined in libgfortran/runtime/memory.c
PS: IIRC we have likely() / unlikely() macros in libgfortran, so you
may want to check if you want to annotate some conditions accordingly
if predict gets it wrong.
thanks,
>
> >+ n->prev = TAIL_RWLOCK_DEBUG_QUEUE; \
> >+ if (n->prev) \
> >+ n->prev->next = n; \
> >+ n->next = NULL; \
> >+ n->line = __LINE__; \
> >+ n->func = __FUNCTION__; \
> >+ n->rw = rwlock; \
> >+ if (!aio_rwlock_debug_head) { \
> >+ aio_rwlock_debug_head = n; \
> >+ } \
> >+ } while (0)
> >+
>