Re: Bring atomic flag fallback up to snuff

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org, Daniel Gustafsson <daniel(at)yesql(dot)se>
Subject: Re: Bring atomic flag fallback up to snuff
Date: 2018-04-07 18:07:05
Message-ID: 7223.1523124425@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)anarazel(dot)de> writes:
> As Daniel pointed out in:
> https://postgr.es/m/FB948276-7B32-4B77-83E6-D00167F8EEB4@yesql.se the
> pg_atomic_flag fallback implementation is broken. That has gone
> unnoticed because the fallback implementation wasn't testable until now:
> ...
> The attached fixes the bug and removes the edge-cases by storing a value
> separate from the semaphore. I should have done that from the start.
> This is an ABI break, but given the fallback didn't work at all, I don't
> think that's a problem for backporting.

> Fix attached. Comments?

pademelon says it's wrong.

2018-04-07 13:39:34.982 EDT [1197:89] pg_regress/lock LOG: statement: SELECT test_atomic_ops();
TRAP: UnalignedPointer("(((uintptr_t) ((uintptr_t)(ptr)) + ((sizeof(*ptr)) - 1)) & ~((uintptr_t) ((sizeof(*ptr)) - 1))) != (uintptr_t)(ptr)", File: "../../../src/include/port/atomics.h", Line: 177)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andreas Seltenreich 2018-04-07 18:08:57 [sqlsmith] Failed assertion in create_gather_path
Previous Message Teodor Sigaev 2018-04-07 18:05:21 Re: json(b)_to_tsvector with numeric values